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

Error to scaffold conversion webhooks #3825

Closed
camilamacedo86 opened this issue Mar 29, 2024 · 4 comments
Closed

Error to scaffold conversion webhooks #3825

camilamacedo86 opened this issue Mar 29, 2024 · 4 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. kind/regression Categorizes issue or PR as related to a regression from a prior release.

Comments

@camilamacedo86
Copy link
Member

What broke? What's expected?

By running the following commands we will face an issue to generate the manifests.
I would expected the scaffolds be done accurately and no issue be faced

  kubebuilder init --plugins="go/v4" --domain=tutorial.kubebuilder.io --project-version=3 --repo=tutorial.kubebuilder.io/project --license apache2 --owner "The Kubernetes authors"
  kubebuilder create api --group batch --version v1 --kind CronJob --resource --controller --make=false
  kubebuilder create webhook --group batch --version v1 --kind CronJob --defaulting --programmatic-validation
  kubebuilder create webhook --group batch --version v1 --kind CronJob --conversion --force
  kubebuilder create api --group batch --version v2 --kind CronJob --resource=true --controller=false
  kubebuilder create webhook --group batch --version v2 --kind CronJob --defaulting --programmatic-validation
  kubebuilder create webhook --group batch --version v2 --kind CronJob --conversion --force
  go mod tidy
  make

Reproducing this issue

Please run the commands provided above. To solve this task, analyze the results and determine the ideal scaffold needed for a fix. Note that resolving this bug involves investigating and understanding the correct approach to working with webhook conversions.

Ask for help in kubebuilder and controller-runtime channels.
Also, ask for review in both channels when you be able to provide a solution

KubeBuilder (CLI) Version

master

PROJECT version

3

Plugin versions

go/v4

Other versions

No response

Extra Labels

/kind regression

@camilamacedo86 camilamacedo86 added the kind/bug Categorizes issue or PR as related to a bug. label Mar 29, 2024
@k8s-ci-robot k8s-ci-robot added the kind/regression Categorizes issue or PR as related to a regression from a prior release. label Mar 29, 2024
@camilamacedo86 camilamacedo86 added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Mar 29, 2024
@Kavinjsir
Copy link
Contributor

/assign

@Kavinjsir
Copy link
Contributor

From my local reproducing, the error is:

INFO Running make:
$ make generate
/Users/tonyjin/pro/tmp/kb/bin/controller-gen-v0.14.0 object:headerFile="hack/boilerplate.go.txt" paths="./..."
Next: implement your new Webhook and generate the manifests with:
$ make manifests
/Users/tonyjin/pro/tmp/kb/bin/controller-gen-v0.14.0 rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
tutorial.kubebuilder.io/project/api/v1:-: CRD for CronJob.batch.tutorial.kubebuilder.io has no storage version
Error: not all generators ran successfully
run `controller-gen rbac:roleName=manager-role crd webhook paths=./... output:crd:artifacts:config=config/crd/bases -w` to see all available markers, or `controller-gen rbac:roleName=manager-role crd webhook paths=./... output:crd:artifacts:config=config/crd/bases -h` for usage
make: *** [manifests] Error 1

I think it is a similar issue to:
#1196

So, when following https://book.kubebuilder.io/multiversion-tutorial/api-changes.html#storage-versions, adding //+kubebuilder:storageversion can help:
Screenshot 2024-03-31 at 9 13 42 PM

@camilamacedo86
Copy link
Member Author

This are the steps to build our tutorial https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/multiversion-tutorial sample.

After add the store it still failing in the e2e test regards the tests added for the webhook.
So, here in this task we need to

It could be a good first issue for someone that would like to spend so effort and get something that is not so trivial and requires investigation.

Help here is very welcome !!!!

@camilamacedo86
Copy link
Member Author

Hi @Kavinjsir

You are 100% . It is the same: #1196.

The problem that I was facing was with the default tests scaffold for the the controller . It was missing declare the resource properly. See; https://github.com/kubernetes-sigs/kubebuilder/actions/runs/8844368662/job/24286141139?pr=3875

I could fix this one, but the tests for the controller still failing
I will raise I new issue with a better description
We need to implement the tests for the controller to ensure that the reconciliation of the sample is accurate.

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. kind/regression Categorizes issue or PR as related to a regression from a prior release.
Projects
None yet
Development

No branches or pull requests

3 participants