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

Don't require names for built-in Kubernetes list types #294

Merged
merged 1 commit into from
Nov 26, 2018

Conversation

hausdorff
Copy link
Contributor

@hausdorff hausdorff commented Nov 24, 2018

.metadata.name is not required for built-in list types. Our provider
expects this property, which means it will crash if it's not given. This
commit changes ouur provider to not expect such.

The specifics are slightly more complex. Here is the background:
Kubernetes does not instantiate or manage the lifecycle of list types
like v1.List. If it receives a list type, it will recursively traverse
it for resource definitions that it is supposed to manage, and then
perform the relevant operation on each. (e.g., apply'ing each
v1.ConfigMap in a v1.ConfigMapList.)

Because of this property, lists are not required to have names.
Unfortunately, while our code handles v1.List correctly, it does not
handle all these other built-in lists. A resource is not specified as a
list in the OpenAPI spec, either, so we will simply generate a set of
checks for things that "look like" lists, and trust that when we update
the OpenAPI spec, we will catch any weirdness in the diffs.

`.metadata.name` is not required for built-in list types. Our provider
expects this property, which means it will crash if it's not given. This
commit changes ouur provider to not expect such.

The specifics are slightly more complex. Here is the background:
Kubernetes does not instantiate or manage the lifecycle of list types
like `v1.List`. If it receives a list type, it will recursively traverse
it for resource definitions that it is supposed to manage, and then
perform the relevant operation on each. (e.g., `apply`'ing each
`v1.ConfigMap` in a `v1.ConfigMapList`.)

Because of this property, lists are not required to have names.
Unfortunately, while our code handles `v1.List` correctly, it does not
handle all these other built-in lists. A resource is not specified as a
list in the OpenAPI spec, either, so we will simply generate a set of
checks for things that "look like" lists, and trust that when we update
the OpenAPI spec, we will catch any weirdness in the diffs.
@hausdorff hausdorff changed the title WIP: Don't require names for anything that looks like a list Don't require names for built-in Kubernetes list types Nov 26, 2018
// Since Kubernetes does not instantiate list types directly, Pulumi also traverses lists
// for resource definitions that can be managed by Kubernetes, and registers those with the
// engine instead.
if (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was this list generated?

What's the process for keeping it updated with newer k8s versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a mustache template, right? It's generated here: https://github.com/pulumi/pulumi-kubernetes/pull/294/files#diff-551fbe30151ad564ca8ed6b6c8f46e40R98

That's picked up from the OpenAPI spec we provide. So it's always automatically up to date.

@hausdorff hausdorff merged commit bd7765d into master Nov 26, 2018
@pulumi-bot pulumi-bot deleted the hausdorff/lists branch November 26, 2018 23:41
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.

None yet

2 participants