-
Notifications
You must be signed in to change notification settings - Fork 96
Add explicit schema for podTemplateSpec.metadata #676
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
Add explicit schema for podTemplateSpec.metadata #676
Conversation
Unknown metadata fields are pruned https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning If you change from v1beta CRDs to v1 CRDs the metadata field is pruned and the operator believes that every podSpec is incorrect. Related to kubernetes-sigs/controller-tools#448
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.
Hi, thanks for the PR! I think you have to change in the Makefile
the CRD_OPTIONS
and add generateEmbeddedObjectMeta=true
e.g. to be CRD_OPTIONS ?= "crd:trivialVersions=true,maxDescLen=0,crdVersions=v1,generateEmbeddedObjectMeta=true"
otherwise a new run of make will remove it again (that's why CI is complaining). After the change you can just run make clean all
and commit the newly generated files. I just noticed that the new field is only available in 0.6.0-beta 🤔
Thanks! Would it be possible to add unit tests to catch issues like this? Another tiny annoyance when upgrading the CRDs is that some extra default values are populated (e.g., |
Using unit-tests will be probably a little bit hard (I would need to check if the default mechanisms are exposed in Kubernetes) but it should be pretty straight forward to add some integration tests for that and I think that most of our tests are actually integration tests. Feel free to add some test cases for that in the PR that would also show/prove that the change actually works like expected.
That should be pretty simple to fix by not using |
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.
The changes look in general good, I'm just not quite sure if we want to use a beta version directly. Let me evaluate that and come back to you.
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.
LGTM 👍 Thanks!
Unknown metadata fields are pruned https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning
If you change from v1beta CRDs to v1 CRDs the metadata field is pruned and the operator believes that every podSpec is incorrect.
Related to kubernetes-sigs/controller-tools#448