Skip to content

kubebuilder make install fails #3460

@rbroggi

Description

@rbroggi

What broke? What's expected?

Following the kubebuilder book, the make install step fails with the error message:

The CustomResourceDefinition "cronjobs.batch.tutorial.kubebuilder.io" is invalid: metadata.annotations: Too long: must have at most 262144 bytes

As described in this post the issue derives from the auto-generated annotation when running kubectl apply.
Running the same command with kubectl create or kubectl replace works.

I was wondering how to correct this issue. Possible approaches:

  1. easy, workaround: insert a warning into the book stating this problem and telling the user to edit the make install;
  2. easy, workaround, fragile: make the install target slightly more intelligent and dynamically choose apply, create or replace depending on whether the CRDs exist and on the possible error;
  3. harder: solve the problem on kubectl apply - here a further discussion needs to be triggered on whether we even want to solve this issue and what impacts that could generate (not sure it would be backwards compatible)
  4. within kubectl apply make a more detailed error and suggest usage of create or replace commands instead.

Reproducing this issue

Follow the kubebuilder book up to the make install in this book section.

KubeBuilder (CLI) Version

Version: main.version{KubeBuilderVersion:"v3.10.0-110-gd9c14df9", KubernetesVendor:"unknown", GitCommit:"d9c14df9d84fafd08c9ec88441e9ce218ad6effa", BuildDate:"2023-06-16T09:47:40Z", GoOs:"darwin", GoArch:"arm64"}

PROJECT version

version: "3"

Plugin versions

- go.kubebuilder.io/v4

Other versions

  • go version go1.20.4 darwin/arm64

  • sigs.k8s.io/controller-runtime v0.15.0

Extra Labels

/kind documentation

Metadata

Metadata

Assignees

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/documentationCategorizes issue or PR as related to documentation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions