-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-generate aliases for all resource kinds #991
Conversation
Rather than manually curating resource aliases, auto-generate the aliases from the OpenAPI spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall seems great to be auto-generating this - there's a long tail of additional APIs we appear to be picking up correct logic for here.
sdk/nodejs/admissionregistration/v1/MutatingWebhookConfiguration.ts
Outdated
Show resolved
Hide resolved
sdk/nodejs/admissionregistration/v1/MutatingWebhookConfiguration.ts
Outdated
Show resolved
Hide resolved
sdk/nodejs/admissionregistration/v1beta1/MutatingWebhookConfiguration.ts
Outdated
Show resolved
Hide resolved
sdk/nodejs/batch/v1beta1/CronJob.ts
Outdated
const _opts = pulumi.mergeOptions(opts, { | ||
aliases: [ | ||
{ parent: opts.parent, type: "kubernetes:batch/v1beta1:CronJob", name: name }, | ||
{ parent: opts.parent, type: "kubernetes:batch/v2alpha1:CronJob", name: name }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that there is a v2
here - does that not indicate some fundamental incompatibility? Does Kubernetes treat these as sharing identity across v1
/v2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any explicit guidance in the upstream docs. However, it probably doesn't make sense to auto-alias to alpha
apiVersions since it's possible that they have backwards-incompatible changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we've already been auto-aliasing a number of alpha
apiVersions, so let's keep it for now, and adjust in the future if we discover that it causes problems.
- Don't specify parent or name - Don't self-alias
apiVersion string | ||
} | ||
aliases := map[string][]interface{}{} | ||
linq.From(definitions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to say, whoever wrote linq for go is both a hero and also this is extremely cursed code thanks to the lack of generics
@ahmetb: thanks, I hate it! ;)
Proposed changes
Rather than manually curating resource aliases, auto-generate
the aliases from the OpenAPI spec.
Related issues (optional)
Fixes #828