kubebuilder: metadata.annotations: Too long: must have at most 262144 bytes
What broke? What’s expected?
clone this project on the machine, an go to dir docs/book/src/multiversion-tutorial/testdata/project . make install deploy; then this error appear
make install deploy
/var/tmp/kubebuilder-master/docs/book/src/multiversion-tutorial/testdata/project/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/var/tmp/kubebuilder-master/docs/book/src/multiversion-tutorial/testdata/project/bin/kustomize build config/crd | kubectl apply -f -
The CustomResourceDefinition "cronjobs.batch.tutorial.kubebuilder.io" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
make: *** [install] Error 1
Reproducing this issue
No response
KubeBuilder (CLI) Version
3.3.0
PROJECT version
3
Plugin versions
No response
Other versions
k8s: v1.21.9 go: 1.16.2 kustomize: v4.5.2 centos: 3.10.0-693.el7.x86_64
Extra Labels
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 25 (8 by maintainers)
Commits related to this issue
- fixed issue with too long metadata.annotations, see https://github.com/kubernetes-sigs/kubebuilder/issues/2556#issuecomment-1207343538 — committed to mondata-dev/cdap-operator by dpoetzsch a year ago
- preserve unknown fields in vulnerabilityreport I built a custom operator (https://github.com/telekom-mms/trivy-dojo-report-operator) that uses the kopf-operator (github.com/nolar/kopf/) framework. Th... — committed to rndmh3ro/trivy-operator by rndmh3ro 10 months ago
- preserve unknown fields in vulnerabilityreport I built a custom operator (https://github.com/telekom-mms/trivy-dojo-report-operator) that uses the kopf-operator (github.com/nolar/kopf/) framework. Th... — committed to rndmh3ro/trivy-operator by rndmh3ro 10 months ago
- preserve unknown fields in vulnerabilityreport I built a custom operator (https://github.com/telekom-mms/trivy-dojo-report-operator) that uses the kopf-operator (github.com/nolar/kopf/) framework. Th... — committed to rndmh3ro/trivy-operator by rndmh3ro 10 months ago
- preserve unknown fields in vulnerabilityreport (#1455) I built a custom operator (https://github.com/telekom-mms/trivy-dojo-report-operator) that uses the kopf-operator (github.com/nolar/kopf/) fram... — committed to aquasecurity/trivy-operator by rndmh3ro 10 months ago
CRD_OPTIONS ?= "crd:maxDescLen=0"in Makefile not work. that’s whymake install; it solvedJust adding that
kubectl apply --server-side=true -favoids metadata byte limitSame here, when following the tutorial https://book.kubebuilder.io/cronjob-tutorial/running
make installthrows this erro message :The CustomResourceDefinition "cronjobs.batch.tutorial.kubebuilder.io" is invalid: metadata.annotations: Too long: must have at most 262144 bytesI am following the book one to one and I got the same problem. Fixed by @ka-keung . This should be fixed asap since it’s literally the tutorial
I solved this problem by adding comments.
Hi @camilamacedo86 -
I was able to recreate the issue. There are two ways through which we can fix this issue.
kubectl apply tokubectl replace --force` as mentioned herePlease take a look at PR and let me know your thoughts.
I was able to resolve this issue in the cronjob example by making the following changes. However, I don’t know if this actually fixes the issue.
File: docs/book/src/cronjob-tutorial/testdata/project/Makefile Lines: 45-53
This seems to happen because the
kubectl applyfrom themake installstep adds thekubectl.kubernetes.io/last-applied-configurationannotation. You can circumvent this behaviour by using a server-side apply. In the Makefile, replace the install with:Also just ran into this working my way through the tutorial. Definitely should be fixed asap