-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
generate openapi: preserve manually modified/added CRD validation #1155
Conversation
@estroz Other than the issue related to overriding the type validation (as alluded to in #1143), are there other validation fields that cannot be controlled and generated from kubebuilder annotations? If not, I think kubebuilder annotations should be the one and only way to populate the CRD validations. If I understand this merge correctly, it seems like users could inadvertently get themselves into interesting situations that are difficult to resolve:
|
@joelanford there are other validations for which no @hasbro17 you originally had issue with overwriting manually modified validations. Any thoughts on @joelanford's concerns? |
@estroz I'm pretty sure that would solve the concern with my second point in that we would prefer the kubebuilder annotation value over the existing value. To solve the issue with changing Go types, would the merge function also be able to delete fields from |
So I agree that we should prefer the validation generated by the kubebuilder tag if present for a particular field. And in the case when So for e.g if @estroz I'm not sure of the actual implementation of the custom merge yet but I think it should be possible to compare and weed out validation fields for which there is no corresponding spec/status field. |
@joelanford @hasbro17 that's doable. |
It sounds like this might be something we would want upstream. Should we
propose this to the controller-tools library?
…On Fri, Mar 1, 2019 at 4:30 PM Eric Stroczynski ***@***.***> wrote:
@joelanford <https://github.com/joelanford> @hasbro17
<https://github.com/hasbro17> that's doable.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#1155 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABza96VTKeSzh3fr77gUVIxw-DufX2Phks5vSZvtgaJpZM4bXq5e>
.
|
What did we decide with this, are we going to contribute upstream, or is this ready for a review? :) |
@lilic opened an issue upstream: kubernetes-sigs/controller-tools#156 /hold |
@estroz Since we're planning to add support for all validation directives upstream, we can close this PR since we don't need to merge and preserve manual additions to the CRD manifest's validation block. |
Description of the change: preserve manually modified/added CRD validation fields.
Motivation for the change: the
generate openapi
command fully overwrites CRD manifest validation blocks and any additional validation fields a user might have added. This change preserves any modifications made after scaffolding CRD manifests while adding new fields.Note that modified fields will not be updated, even if a Go type is changed. Thoughts on this drawback?