-
Notifications
You must be signed in to change notification settings - Fork 39
Fix CRD installation #40
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
Fix CRD installation #40
Conversation
e03b7d0 to
9af3784
Compare
Currently running a make install to install the CRD's in a cluster fails. We run into: Error from server (Invalid): error when creating "STDIN": CustomResourceDefinition.apiextensions.k8s.io "adminnetworkpolicies.policy.networking.k8s.io" is invalid: [spec.validation.openAPIV3Schema.properties[spec].properties[egress].items.properties[ports].items.properties[portNumber].properties[protocol].allOf[0].default: Forbidden: must be undefined to be structural, spec.validation.openAPIV3Schema.properties[spec].properties[egress].items.properties[ports].items.properties[portNumber].properties[protocol].allOf[1].default: Forbidden: must be undefined to be structural, spec.validation.openAPIV3Schema.properties[spec].properties[egress].items.properties[ports].items.properties[portRange].properties[protocol].allOf[0].default: Forbidden: must be undefined to be structural, spec.validation.openAPIV3Schema.properties[spec].properties[egress].items.properties[ports].items.properties[portRange].properties[protocol].allOf[1].default: Forbidden: must be undefined to be structural, spec.validation.openAPIV3Schema.properties[spec].properties[ingress].items.properties[ports].items.properties[portNumber].properties[protocol].allOf[0].default: Forbidden: must be undefined to be structural, spec.validation.openAPIV3Schema.properties[spec].properties[ingress].items.properties[ports].items.properties[portNumber].properties[protocol].allOf[1].default: Forbidden: must be undefined to be structural, spec.validation.openAPIV3Schema.properties[spec].properties[ingress].items.properties[ports].items.properties[portRange].properties[protocol].allOf[0].default: Forbidden: must be undefined to be structural, spec.validation.openAPIV3Schema.properties[spec].properties[ingress].items.properties[ports].items.properties[portRange].properties[protocol].allOf[1].default: Forbidden: must be undefined to be structural] This PR fixes this since defining the default as TCP is breaking the installation. Signed-off-by: Surya Seetharaman <[email protected]>
9af3784 to
5f526d6
Compare
| type Port struct { | ||
| // Protocol is the network protocol (TCP, UDP, or SCTP) which traffic must | ||
| // match. If not specified, this field defaults to TCP. | ||
| // +kubebuilder:default=TCP |
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.
It's possible I might need to use https://github.com/kubernetes/apiextensions-apiserver/blob/aabbdff63fe0a4e940e7cbe3e5188c3b6e4b63bf/pkg/apiserver/schema/validation.go#L49 (x-kubernetes-int-or-string: true) instead ? Would be good to check with an api expert.
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.
no I think we are good here.
| allOf: | ||
| - default: TCP | ||
| - default: TCP | ||
| default: TCP |
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.
Sou manually added this right? Does it get removed when you run make all? I wonder why this kube builder tag isn't working right :(
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 didn't manually add it, that's the best part! not exactly sure how the default:TCP is populated, but it wasn't me. I simply did the mentioned changes in the types.go and ran make install and it seems to fill in this value.
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.
Yep theres some legacy API funniness ensuring the default, see https://github.com/kubernetes/api/blob/master/networking/v1/types.go#L148 there's no explicit default in netpol either
This should be alright!
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.
It's probably that port.protocol already has TCP as its magic default somehow.
|
I didn't know about that K8s name limitation thanks so much for catching this! |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: astoycos, tssurya The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Currently running a make install to install the CRD's in a cluster fails. We run into:
This PR fixes this since defining the default protocol as TCP is breaking the installation.
Signed-off-by: Surya Seetharaman [email protected]