Skip to content

kubebuilder create api --resource=false generates references to non-existent resources #5097

@haskjold

Description

@haskjold

What broke? What's expected?

When using --resource=false some things are not created like the crd and api dirs with its corresponding content.

But these are still references in various places:

  1. The Dockerfile has a COPY api/ api/
  2. internal/controller/suite_test.go lists the crd dir: CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
  3. test/e2e/e2e_test.go contain steps for make install and make uninstall that also are for the non-existing crds in this case

I'm creating several ctrls with --resource=false and it would be nice to not have to manually clean this up every time.

Reproducing this issue

No response

KubeBuilder (CLI) Version

Version: cmd.version{KubeBuilderVersion:"4.8.0", KubernetesVendor:"1.33.0", GitCommit:"a069bf1a12785fa210409c558ae668565296c675", BuildDate:"2025-08-27T11:08:55Z", GoOs:"linux", GoArch:"amd64"}

PROJECT version

3

Plugin versions

Other versions

No response

Extra Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions