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

CRD "Strict mode" to validate schema on create and edit #2903

Closed
perithompson opened this issue Sep 11, 2020 · 4 comments · Fixed by #2916
Closed

CRD "Strict mode" to validate schema on create and edit #2903

perithompson opened this issue Sep 11, 2020 · 4 comments · Fixed by #2916
Assignees

Comments

@perithompson
Copy link

Please describe the problem you have

During the creation of new HTTPProxy resources, values, such as timeoutPolicy, can be incorrectly indented and the creation will be accepted without any errors or warnings. This can lead to long periods of troubleshooting believing the timeoutPolicy has been set correctly rather than being ignored. Could the CRD be edited to include a "strict mode" to validate the structure allowing for warnings to be presented for incorrect structure or prevent the object being created at all? This would greatly improve confidence in production deployments where it is important to validate the configuration is as expected.

@skriss
Copy link
Member

skriss commented Sep 11, 2020

xref #1978

@youngnick
Copy link
Member

Thanks for this issue @perithompson. Functionally, we hope to deliver this by moving out CustomResourceDefinitions from v1alpha1 of the CRD object to v1 of the CRD object (#2678). That issue blocks a whole bunch of things, but we have been waiting until we could be reasonably confident that most of our users were running Kubernetes 1.16, which is the first version that had CRDv1 available.

Now that is the case, I'm hoping to push ahead with the CRDv1 work, which will enable pruning by default. Currently, when you send an object to the apiserver, any YAML that does not match the structural schema will be persisted to etcd, so when you ask for the object to check it, you'll get the full YAML, including the nonfunctional pieces back. CRDv1 has pruning enabled by default, while also enabling some other great features like kubectl explain (#1753).

Please keep watch on #2678, as that's currently blocking this feature. I'm not sure if we'll be able to get that change in for 1.9, but we will see what we can do. Could you confirm if you're using at least Kubernetes 1.16?

@perithompson
Copy link
Author

Thanks for this @youngnick makes sense! Will add a watch to that issue, and in this case, it was Kubernetes 1.16.x where we experienced the problem.

@youngnick
Copy link
Member

Awesome, I think I'm going to see if we can get CRDv1 into 1.9 - a big ask, but possible.

@skriss skriss self-assigned this Sep 16, 2020
skriss added a commit to skriss/contour that referenced this issue Sep 16, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 17, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 17, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 17, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 18, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit to skriss/contour that referenced this issue Sep 21, 2020
Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1.

Closes projectcontour#2678
Closes projectcontour#1723
Closes projectcontour#1978
Closes projectcontour#2903
Closes projectcontour#2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
skriss added a commit that referenced this issue Sep 21, 2020
examples: generate v1 CustomResourceDefinitions

Updates the Contour CustomResourceDefinition YAML files
to contain v1 resources instead of v1beta1 with preserveUnknownFields
set to false. Also adds a check on `contour serve` for non-upgraded 
CRDs, and logs a warning if found.

Closes #2678
Closes #1723
Closes #1978
Closes #2903
Closes #2527

Signed-off-by: Steve Kriss <krisss@vmware.com>
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 a pull request may close this issue.

3 participants