Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubebuilder alpha generate fails to rescaffold if PROJECT contains go.kubebuilder.io/v3 #4433

Open
lack opened this issue Dec 17, 2024 · 2 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@lack
Copy link

lack commented Dec 17, 2024

What broke? What's expected?

I'm trying to upgrade an old project to go/v4 via kubebuilder.

Here's what I tried:

kubebuilder alpha generate --plugins "go.kubebuilder.io/v4"

Here's what I got:

INFO kubebuilder init:
$ kubebuilder init --plugins go.kubebuilder.io/v3 --domain eapol.openshift.io 
Error: no plugin could be resolved with key "go.kubebuilder.io/v3"
Usage:
  kubebuilder [flags]

Examples:
The first step is to initialize your project:
    kubebuilder init [--plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]]

<PLUGIN KEYS> is a comma-separated list of plugin keys from the following table
and <PROJECT VERSION> a supported project version for these plugins.

                             Plugin keys | Supported project versions
-----------------------------------------+----------------------------
               base.go.kubebuilder.io/v4 |                          3
 deploy-image.go.kubebuilder.io/v1-alpha |                          3
                    go.kubebuilder.io/v4 |                          3
         grafana.kubebuilder.io/v1-alpha |                          3
      kustomize.common.kubebuilder.io/v2 |                          3

For more specific help for the init command of a certain plugins and project version
configuration please run:
    kubebuilder init --help --plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]

Default plugin keys: "go.kubebuilder.io/v4"
Default project version: "3"


Flags:
  -h, --help                     help for kubebuilder
      --plugins strings          plugin keys to be used for this subcommand execution
      --project-version string   project version (default "3")

FATA no plugin could be resolved with key "go.kubebuilder.io/v3" 
FATA Failed to command exit status 1

Reproducing this issue

Originating PROJECT file contained

layout:
- go.kubebuilder.io/v3

KubeBuilder (CLI) Version

Version: main.version{KubeBuilderVersion:"4.3.1", KubernetesVendor:"1.31.0", GitCommit:"a9ee3909f7686902879bd666b92deec4718d92c9", BuildDate:"2024-11-09T12:30:22Z", GoOs:"linux", GoArch:"amd64"}

PROJECT version

3

Plugin versions

plugins:
  manifests.sdk.operatorframework.io/v2: {}
  scorecard.sdk.operatorframework.io/v2: {}

Other versions

go version go1.23.3 linux/amd64

Extra Labels

No response

@lack lack added the kind/bug Categorizes issue or PR as related to a bug. label Dec 17, 2024
@camilamacedo86
Copy link
Member

Workaround

Update the PROJECT file and replace go.kubebuilder.io/v3 with go.kubebuilder.io/v4

Solution: What we need to do here

If we run kubebuilder alpha generate, we will do the same scaffold for the default plugin in Kubebuilder
The problem is here: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/cli/alpha/internal/generate.go#L254-L265

We are using the same plugins for all of them.

@camilamacedo86
Copy link
Member

The problem is actually here: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/cli/cli.go#L99-L103

When we try to solve the plugins: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/cli/cli.go#L169-L172
because for v4 those plugins are no longer supported

We need add here a solution that works ONLY for kubebuilder alpha generate command
We might want to check that it is the command used and update the PROJECT file with a support plugin before run the command such as the above workaround.

@camilamacedo86 camilamacedo86 added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Dec 18, 2024
@varshaprasad96 varshaprasad96 self-assigned this Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

No branches or pull requests

3 participants