-
Notifications
You must be signed in to change notification settings - Fork 422
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
Error applying a CRD generated by controller-tools that contains the ContainerPort struct #1027
Comments
It affects https://github.com/kubernetes-sigs/controller-tools/releases/tag/v0.16.0-beta.0, works with v0.15.0 in my case |
Another case was reported here: #1034 |
I assume the relevant change since v0.15.0 is this one: #938 |
Not sure what's going on, clearly looks like a bug: // Protocol for port. Must be UDP, TCP, or SCTP.
// Defaults to "TCP".
// +optional
// +default="TCP"
Protocol corev1.Protocol `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol,casttype=Protocol"` leads to protocol:
allOf:
- default: TCP
- default: TCP
description: |-
Protocol for port. Must be UDP, TCP, or SCTP.
Defaults to "TCP".
type: string |
Oh my... controller-tools/pkg/crd/known_types.go Lines 28 to 35 in 0adb7e1
|
Good catch! |
@sbueringer do you want to fix it? |
Already on it |
PR is open: #1035 If possible, please also test in your use cases to ensure it fixes the entire issue (although I'm pretty confident) Once the PR merges I would cut a patch release |
Yes, it's working fine. Thank you so much! |
It does look like it doesn't produce the defaults for container port. 👍 |
Thx for reporting everyone! v0.16.1 with the fix is now available: https://github.com/kubernetes-sigs/controller-tools/releases/tag/v0.16.1 |
I have the following types.go file:
after generating a CRD from this code with controller-gen like so:
controller-gen crd:generateEmbeddedObjectMeta=true paths="./pkg/apis/..." output:stdout | tail -n +2 > manifests/crd.yaml
and trying to apply with
kubectl create
I get the following error(s):after some messing around i found that removing the
// +default="TCP"
comment from ContainerPort.Protocol in k8s.io/api, fixes the issue while maintaining the default value of TCP in the CRD itself.versions:
The text was updated successfully, but these errors were encountered: