Skip to content
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

Merged
merged 4 commits into from
Feb 18, 2020

Conversation

lblackstone
Copy link
Member

Proposed changes

Rather than manually curating resource aliases, auto-generate
the aliases from the OpenAPI spec.

Related issues (optional)

Fixes #828

Rather than manually curating resource aliases, auto-generate
the aliases from the OpenAPI spec.
Copy link
Member

@lukehoban lukehoban left a 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/apps/v1/ControllerRevision.ts Outdated Show resolved Hide resolved
sdk/nodejs/apps/v1/StatefulSet.ts Show resolved Hide resolved
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 },
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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
@lblackstone lblackstone merged commit 4d922c7 into master Feb 18, 2020
@pulumi-bot pulumi-bot deleted the lblackstone/auto-gen-aliases branch February 18, 2020 19:22
apiVersion string
}
aliases := map[string][]interface{}{}
linq.From(definitions).
Copy link
Member

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! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-alias all apiVersions rather than hardcoded set
4 participants