Skip to content

Instantly share code, notes, and snippets.

@1eedaegon
Last active April 24, 2024 07:55
Show Gist options
  • Save 1eedaegon/83db07a14f6035ee0bd5c1c630187e6d to your computer and use it in GitHub Desktop.
Save 1eedaegon/83db07a14f6035ee0bd5c1c630187e6d to your computer and use it in GitHub Desktop.
solution: kubebuilder The CustomResourceDefinition "blah" is invalid: metadata.annotations: Too long: must have at most 262144 bytes

Trouble sample

like this: is invalid: metadata.annotations: Too long: must have at most 262144

make install # kubeduiler generated makefile

/home/lee-ubuntu/workspace/pipeline-operator/bin/kustomize-v5.3.0 build config/crd | kubectl apply -f -
customresourcedefinition.apiextensions.k8s.io/pipelines.pipeline.1eedaegon.github.io unchanged
customresourcedefinition.apiextensions.k8s.io/tasks.pipeline.1eedaegon.github.io unchanged
The CustomResourceDefinition "runs.pipeline.1eedaegon.github.io" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
make: *** [Makefile:136: install] Error 1

Solution

Fix crd option on makefile: crd -> crd:maxDescLen=0

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
	$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases

Ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment