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

[WIP] Do not allow extra fields when validating CRDs #422

Closed
wants to merge 1 commit into from

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Jan 23, 2019

@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

Signed-off-by: David Gageot <david@gageot.net>
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 23, 2019
@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dgageot
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: pivotal-nader-ziada

If they are not already assigned, you can assign the PR to them by writing /assign @pivotal-nader-ziada in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 23, 2019
@knative-metrics-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-knative-build-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/task_validation.go 90.9% 91.5% 0.6

@knative-prow-robot
Copy link

@dgageot: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-knative-build-pipeline-integration-tests 862c312 link /test pull-knative-build-pipeline-integration-tests

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 {
Copy link
Collaborator

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 🤔 )

@bobcatfish
Copy link
Collaborator

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 bobcatfish closed this Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants