-
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
CustomResourceDefinition is invalid at kubernetes 1.18 #3235
Comments
wow, this looks like a sig-apimachinery issue. |
Yeah this may be an upstream bug if kubebuilder is similarly affected. /triage needs-information |
/assign |
@estroz it took some hunting... but I found the open issue around this: kubernetes-sigs/controller-tools#444 There is good detail discussion on this thread: kubernetes/kubernetes#91395 the core of it is:
|
It seems like removing core Kubernetes types scheme from crd open API is only one working solution for now. Probably it can be solved with some kubebuilder api marker in the future. Should i address this issue to kubebuilder? |
/cc @jennybuckley @jpbetz |
|
Is there any update for this issue? |
I've decided to remove inherited open api scheme for kubernetes built-in objects from my crds. My motivation - it makes crd heavier. So, you cannot use kubectl apply -f crd.yaml for crd spec with few v1.Container fields. And some integrations breaks as well (operator-hub tests for instance). |
This is an workaround for k8s 1.18 crd to remove the required field protocol See: - datastax/cass-operator#132 - kubernetes-sigs/controller-tools#444 - operator-framework/operator-sdk#3235
This is an workaround for k8s 1.18 crd to remove the required field protocol See: - datastax/cass-operator#132 - kubernetes-sigs/controller-tools#444 - operator-framework/operator-sdk#3235
Hello, still nothing new ? I would define this as a major issue. |
Workaround for post-v1.0 projects: # Set CRD version so v1beta1 versions are generated
sed -i 's/\(CRD_OPTIONS ?= "crd:\)/\1crdVersions={v1beta1},/g' Makefile # If you have any webhooks:
sed -i 's/\(+kubebuilder:webhook:\)/\1webhookVersions={v1beta1},admissionReviewVersions={v1beta1},/g' api/<version>/<kind>_webhook.go # Then install the controller-gen binary containing the fix
rm -f $(command -v controller-gen)
mkdir tmp && pushd tmp && go mod init tmp
go get sigs.k8s.io/controller-tools/cmd/controller-gen@6fa696de4772fb44595d25355946254885a202df
popd tmp && rm -rf tmp
make manifests |
Hi, i tried your fix, without results, with a simple example :
Following your instructions, My makefile is like : and my controller-gen version :
When i try to install the crd :
Thanks. Edit : Same error if i use v1 instead of v1beta1. |
@gmtstephane I linked the wrong commit in the instructions, try |
|
Workaround for 0.18.x projects: The generated manifests have the Required changes: hensur@ffa2f2c |
Since this is fixed upstream but isn't available because |
This is still an upstream issue, see kubernetes-sigs/controller-tools#529. I'm moving this to the backlog until this is resolved in controller-gen once and for all, and a patched v0.3 version is created for go/v2 projects. |
FYI for those with recent projects, controller-gen 4.1 has a workaround |
cc @apelisse for the map key defaulting aspect of this |
We fixed this in Kubernetes 1.19. Let me know if I can help. |
For me it works, thanks! |
This patch adds a new parameter to the CRD named `podTemplate`, containing a template that is used to create Pods for PostgreSQL instances. This feature is useful to fine-grain configure things that don't have a direct field in CRD, like NodeAffinity. The patch also updates the version of `controllen-gen` we are using the latest version because the previous one had a bug preventing the generation of CRDs where PodTemplate is used. More information can be found here: operator-framework/operator-sdk#3235 Co-authored-by: Leonardo Cecchi <leonardo.cecchi@2ndquadrant.it> Co-authored-by: Jonathan Gonzalez V <jonathan.gonzalez@2ndquadrant.com> Co-authored-by: Marco Nenciarini <marco.nenciarini@2ndquadrant.it> Co-authored-by: Gabriele Bartolini <gabriele.bartolini@2ndquadrant.it>
This patch adds a new parameter to the CRD named `podTemplate`, containing a template that is used to create Pods for PostgreSQL instances. This feature is useful to fine-grain configure things that don't have a direct field in CRD, like NodeAffinity. The patch also updates the version of `controllen-gen` we are using the latest version because the previous one had a bug preventing the generation of CRDs where PodTemplate is used. More information can be found here: operator-framework/operator-sdk#3235 Co-authored-by: Leonardo Cecchi <leonardo.cecchi@2ndquadrant.it> Co-authored-by: Jonathan Gonzalez V <jonathan.gonzalez@2ndquadrant.com> Co-authored-by: Marco Nenciarini <marco.nenciarini@2ndquadrant.it> Co-authored-by: Gabriele Bartolini <gabriele.bartolini@2ndquadrant.it>
This patch adds a new parameter to the CRD named `podTemplate`, containing a template that is used to create Pods for PostgreSQL instances. This feature is useful to fine-grain configure things that don't have a direct field in CRD, like NodeAffinity. The patch also updates the version of `controllen-gen` we are using the latest version because the previous one had a bug preventing the generation of CRDs where PodTemplate is used. More information can be found here: operator-framework/operator-sdk#3235 Co-authored-by: Leonardo Cecchi <leonardo.cecchi@2ndquadrant.it> Co-authored-by: Jonathan Gonzalez V <jonathan.gonzalez@2ndquadrant.com> Co-authored-by: Marco Nenciarini <marco.nenciarini@2ndquadrant.it> Co-authored-by: Gabriele Bartolini <gabriele.bartolini@2ndquadrant.it>
Bug Report
What did you do?
create a new operator and add it api into it:
Add init containers to pkg/apis/v1alpha1/appservice_types.go
generate new crd and apply it:
get error:
What did you expect to see?
add CRD without an error
What did you see instead? Under which circumstances?
error:
Environment
1.18.1
1.13.4
1.18.2
Kubernetes cluster kind:
Are you writing your operator in ansible, helm, or go?
Possible Solution
Additional context
This problem is related to new 1.18 validations:
kubernetes-sigs/kubebuilder#1544
protocol - must have default value TCP:
default: TCP
The text was updated successfully, but these errors were encountered: