Don't require names for built-in Kubernetes list types #294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
.metadata.name
is not required for built-in list types. Our providerexpects 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 traverseit for resource definitions that it is supposed to manage, and then
perform the relevant operation on each. (e.g.,
apply
'ing eachv1.ConfigMap
in av1.ConfigMapList
.)Because of this property, lists are not required to have names.
Unfortunately, while our code handles
v1.List
correctly, it does nothandle 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.