-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[WIP] Do not allow extra fields when validating CRDs #422
Conversation
Signed-off-by: David Gageot <david@gageot.net>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dgageot If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The following is the coverage report on pkg/.
|
@dgageot: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@@ -26,12 +27,57 @@ import ( | |||
) | |||
|
|||
func (t *Task) Validate() *apis.FieldError { | |||
if appliedConfig, present := t.Annotations["kubectl.kubernetes.io/last-applied-configuration"]; present { |
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.
@dgageot so the general idea is that the last-applied-configuration
annotation contains all of the fields, so we can use that to check if there are any extra fields 🤔
does it contain all the optional fields as well? id hazard a guess that it doesn't? (if it did, the annotations on a Task
would contain all of the possible fields in a Container
🤔 )
I'm gonna close this for now b/c the conversation has fizzled out but it'll be here for anyone who wants to pick up on #297 again |
@bobcatfish This is a prototype of how CRD validation could be augmented to check for extra fields.
Signed-off-by: David Gageot david@gageot.net