kubebuilder icon indicating copy to clipboard operation
kubebuilder copied to clipboard

(Phase 2 Plugins): external plugin will rebind `--group`, `--version`, `--kind` flags

Open everettraven opened this issue 2 years ago • 0 comments

What broke? What's expected?

When running kubebuilder create api or kubebuilder create webhook with the --plugins flag set to use an external plugin, the external plugin flag binding logic will attempt to rebind the --group, --version, and --kind flags. These flags are already bound automatically by Kubebuilder.

The external plugin flag binding logic needs to be modified to ensure that we do NOT attempt to bind any flags that kubebuilder has already bound. This would likely need to be done here: https://github.com/kubernetes-sigs/kubebuilder/blob/95f55fcf8b87397f7fdf97456b10ff70b31f728e/pkg/plugins/external/helpers.go#L158-L178

and here: https://github.com/kubernetes-sigs/kubebuilder/blob/95f55fcf8b87397f7fdf97456b10ff70b31f728e/pkg/plugins/external/helpers.go#L180-L198

Reproducing this issue

It is not trivial to reproduce this issue, and I only encountered it when creating a sample Phase 2 Plugin that can be used for e2e testing the Phase 2 Plugins implementation.

KubeBuilder (CLI) Version

Version: main.version{KubeBuilderVersion:"v3.5.0-46-g60d0c6ee-dirty", KubernetesVendor:"unknown", GitCommit:"60d0c6ee9eeb1c07dee1eed88ba4004362ec42a7", BuildDate:"2022-07-06T20:56:11Z", GoOs:"linux", GoArch:"amd64"}

PROJECT version

No response

Plugin versions

No response

Other versions

Go: go version go1.18.3 linux/amd64

Extra Labels

No response

everettraven avatar Jul 07 '22 18:07 everettraven