-
Notifications
You must be signed in to change notification settings - Fork 38.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
make PodIP.IP required. #124904
base: master
Are you sure you want to change the base?
make PodIP.IP required. #124904
Conversation
Hi @liangyuanpeng. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: liangyuanpeng The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
even though these list types accurately reflect the structure / validation in built-in types, fields used as map keys must be required or defaulted when used in a CRD schema see kubernetes#124540 kubernetes#124540 Signed-off-by: Lan Liang <gcslyp@gmail.com>
71d8e3d
to
ddd5a6b
Compare
@@ -4344,6 +4344,7 @@ type PodDNSConfigOption struct { | |||
// PodIP represents a single IP address allocated to the pod. | |||
type PodIP struct { | |||
// IP is the IP address assigned to the pod | |||
// +required |
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.
I haven't found a way to verify if this works using ""
as the default value, like the test of #124553 (comment)
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.
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.
all this does is publish the IP field as required in the openapi schema
because API validation already requires IP be set and valid, there's no need to set +default=""
or anything like that
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.
Don't we also need to remove omitempty
?
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.
I really don't want to change the serialization for this just to fix the schema required-ness
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.
Don't we also need to remove
omitempty
?
Just adding +required effectively marks the field as required in the openapi schema.
With kubernetes-sigs/controller-tools#944, I don't think fiddling with omitempty is required any more. Not sure when https://github.com/kubernetes-sigs/controller-tools will cut a release with that.
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.
Do we drop omitempty and push this into a backport ASAP or do we wait for that controller-tools and then backport THAT + this?
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/ok-to-test |
/retest |
/triage accepted |
Is there anything that prevents this from being approved? We missed v1.30.2 release. Hope that get this in v1.30.3. |
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.
Sorry, I have been focused on KEPs and sick - I understand the desire not to fiddle with serialization here, but I am not sure if that is worse than waiting more?
@@ -4344,6 +4344,7 @@ type PodDNSConfigOption struct { | |||
// PodIP represents a single IP address allocated to the pod. | |||
type PodIP struct { | |||
// IP is the IP address assigned to the pod | |||
// +required |
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.
Do we drop omitempty and push this into a backport ASAP or do we wait for that controller-tools and then backport THAT + this?
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fixes CRD generation for types that contain PodStatus
spec.validation.openAPIV3Schema.properties[status].properties[podIPs].items.properties[ip].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property
cc @thockin @liggitt
cc @tatsuhiro-t
Which issue(s) this PR fixes:
Fixes #124900
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: