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

New changes in kubebuilder causing issue in SDK testcases #6046

Closed
laxmikantbpandhare opened this issue Sep 29, 2022 · 10 comments · Fixed by #6047
Closed

New changes in kubebuilder causing issue in SDK testcases #6046

laxmikantbpandhare opened this issue Sep 29, 2022 · 10 comments · Fixed by #6047
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@laxmikantbpandhare
Copy link
Member

Feature Request

Describe the problem you need a feature to resolve.

kubebuilder scaffolding logic got changed

Describe the solution you'd like.

go lang

Before kb changes

Writing kustomize manifests for you to edit...
Writing scaffold for you to edit...
Get controller runtime:
$ go get sigs.k8s.io/controller-runtime@v0.13.0
Update dependencies:
$ go mod tidy
Next: define a resource with:
$ operator-sdk create api
laxmikantbhaskarpandhare@lpandhar-mac confog-manager % tree
.
├── Dockerfile
├── Makefile
├── PROJECT
├── README.md
├── config
│   ├── default
│   │   ├── kustomization.yaml
│   │   ├── manager_auth_proxy_patch.yaml
│   │   └── manager_config_patch.yaml
│   ├── manager
│   │   ├── controller_manager_config.yaml
│   │   ├── kustomization.yaml
│   │   └── manager.yaml
│   ├── manifests
│   │   └── kustomization.yaml
│   ├── prometheus
│   │   ├── kustomization.yaml
│   │   └── monitor.yaml
│   ├── rbac
│   │   ├── auth_proxy_client_clusterrole.yaml
│   │   ├── auth_proxy_role.yaml
│   │   ├── auth_proxy_role_binding.yaml
│   │   ├── auth_proxy_service.yaml
│   │   ├── kustomization.yaml
│   │   ├── leader_election_role.yaml
│   │   ├── leader_election_role_binding.yaml
│   │   ├── role_binding.yaml
│   │   └── service_account.yaml
│   └── scorecard
│       ├── bases
│       │   └── config.yaml
│       ├── kustomization.yaml
│       └── patches
│           ├── basic.config.yaml
│           └── olm.config.yaml
├── go.mod
├── go.sum
├── hack
│   └── boilerplate.go.txt
└── main.go

10 directories, 30 files

After

.
├── Dockerfile
├── Makefile
├── PROJECT
├── README.md
├── config
│   ├── default
│   │   ├── kustomization.yaml
│   │   ├── manager_auth_proxy_patch.yaml
│   │   └── manager_config_patch.yaml
│   ├── manager
│   │   ├── kustomization.yaml
│   │   └── manager.yaml
│   ├── manifests
│   │   └── kustomization.yaml
│   ├── prometheus
│   │   ├── kustomization.yaml
│   │   └── monitor.yaml
│   ├── rbac
│   │   ├── auth_proxy_client_clusterrole.yaml
│   │   ├── auth_proxy_role.yaml
│   │   ├── auth_proxy_role_binding.yaml
│   │   ├── auth_proxy_service.yaml
│   │   ├── kustomization.yaml
│   │   ├── leader_election_role.yaml
│   │   ├── leader_election_role_binding.yaml
│   │   ├── role_binding.yaml
│   │   └── service_account.yaml
│   └── scorecard
│       ├── bases
│       │   └── config.yaml
│       ├── kustomization.yaml
│       └── patches
│           ├── basic.config.yaml
│           └── olm.config.yaml
├── go.mod
├── go.sum
├── hack
│   └── boilerplate.go.txt
└── main.go

``config/manager/controller_manager_config.yamlwill be scaffolded only after--component-config` flag is enabled.

The Kubebuilder issue is here - kubernetes-sigs/kubebuilder#2782
PR for the same: kubernetes-sigs/kubebuilder#2826

@laxmikantbpandhare laxmikantbpandhare self-assigned this Sep 29, 2022
@laxmikantbpandhare
Copy link
Member Author

As part of this issue, we need to modify test cases and docs from operator-sdk.

@laxmikantbpandhare laxmikantbpandhare changed the title New changes in kubebuilder causing issue in SDK New changes in kubebuilder causing issue in SDK testcases Sep 29, 2022
@laxmikantbpandhare
Copy link
Member Author

ERRO[0001] error creating the project: operator-sdk init --plugins helm --domain example.com --group cache --version v1alpha1 --kind Memcached --helm-chart ../../../hack/generate/samples/internal/helm/testdata/memcached-0.0.2.tgz failed with error: (exit status 1) Writing kustomize manifests for you to edit...
Error: failed to initialize project: unable to scaffold with "base.helm.sdk.operatorframework.io/v1": error updating init manifests: stat config/manager/controller_manager_config.yaml: no such file or directory

@laxmikantbpandhare
Copy link
Member Author

KB issue - kubernetes-sigs/kubebuilder#2782

@jberkhahn jberkhahn added this to the Backlog milestone Oct 3, 2022
@jberkhahn jberkhahn added kind/feature Categorizes issue or PR as related to a new feature. kind/bug Categorizes issue or PR as related to a bug. labels Oct 3, 2022
@jmrodri
Copy link
Member

jmrodri commented Oct 3, 2022

Based on the error in comment 3 above that looks like the manifests plugin doesn't know about the file config/manager/controller_manager_config.yaml. But based on comment 4 above the component config is supposed to be optional, as the Kubebuilder issue states "Meta - ComponentConfig scaffolds should not be done by default".

@jmrodri
Copy link
Member

jmrodri commented Oct 3, 2022

@laxmikantbpandhare I think what I would try first is using a branch of operator-sdk that contains the updated kubebuilder in it. Do the following:

make install # install operator-sdk with the updated kubebuilder 
operator-sdk init --plugins helm --domain example.com --group cache --version v1alpha1 --kind Memcached --helm-chart ../../../hack/generate/samples/internal/helm/testdata/memcached-0.0.2.tgz # use the above operator-sdk you built to initialize a new helm operator

Might be worth adding some debug to the manifest plugin to find out why it is choking.

@laxmikantbpandhare
Copy link
Member Author

laxmikantbpandhare commented Oct 3, 2022

Yes, I tried the above command and got the same error on the terminal.

FATA[0000] failed to initialize project: unable to scaffold with "base.helm.sdk.operatorframework.io/v1": error updating init manifests: stat config/manager/controller_manager_config.yaml: no such file or directory 

Then, I tried the below command and it scaffolded the file but with one more error which we discussed earlier.

operator-sdk init --plugins helm --domain example.com --group cache --version v1alpha1 --kind Memcached --component-config --helm-chart ../../../hack/generate/samples/internal/helm/testdata/memcached-0.0.2.tgz
laxmikantbhaskarpandhare@lpandhar-mac check % ls
config
laxmikantbhaskarpandhare@lpandhar-mac check % tree config 
config
├── default
│   ├── kustomization.yaml
│   ├── manager_auth_proxy_patch.yaml
│   └── manager_config_patch.yaml
├── manager
│   ├── controller_manager_config.yaml
│   ├── kustomization.yaml
│   └── manager.yaml
├── prometheus
│   ├── kustomization.yaml
│   └── monitor.yaml
└── rbac
    ├── auth_proxy_client_clusterrole.yaml
    ├── auth_proxy_role.yaml
    ├── auth_proxy_role_binding.yaml
    ├── auth_proxy_service.yaml
    ├── kustomization.yaml
    ├── leader_election_role.yaml
    ├── leader_election_role_binding.yaml
    ├── role_binding.yaml
    └── service_account.yaml

The new error is:

FATA[0000] failed to initialize project: unable to scaffold with "base.helm.sdk.operatorframework.io/v1": error updating init manifests: string --leader-elect not found in apiVersion: v1

@laxmikantbpandhare
Copy link
Member Author

laxmikantbpandhare commented Oct 9, 2022

@jmrodri - I found the bug on Kubebuilder which was missed as part of the --component-config flag enablement process.

Issue - kubernetes-sigs/kubebuilder#3009
PR - kubernetes-sigs/kubebuilder#3010

@jmrodri
Copy link
Member

jmrodri commented Oct 9, 2022

@laxmikantbpandhare okay, that makes sense. I think we need to get that merged into kubebuilder and do a point release of kubebuilder. Then bring that into SDK.

@laxmikantbpandhare
Copy link
Member Author

laxmikantbpandhare commented Oct 9, 2022

Yes, a minor release is needed. Does the recent KB git commit work with SDK or minor release is required for sure?

@laxmikantbpandhare laxmikantbpandhare modified the milestones: Backlog, v1.25.0 Oct 17, 2022
@laxmikantbpandhare
Copy link
Member Author

This is fixed as part of #6047

@laxmikantbpandhare laxmikantbpandhare linked a pull request Oct 17, 2022 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants