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

Attempt to use manager_config_patch.yaml results in "flag provided but not defined: -config" #5884

Closed
larsks opened this issue Jun 18, 2022 · 5 comments
Assignees
Labels
language/go Issue is related to a Go operator project

Comments

@larsks
Copy link

larsks commented Jun 18, 2022

Bug Report

What did you do?

I have build a simple operator using operator-sdk version:

operator-sdk version: "v1.22.0", commit: "9e95050a94577d1f4ecbaeb6c2755a9d2c231289", kubernetes version: "1.24.1", go version: "go1.18.3", GOOS: "linux", GOARCH: "amd64"

The generated manifests include config/manager/controller_manager_config.yaml, which when patched in via config/default/manager_config_patch.yaml sets the manager args to:

        args:
        - "--config=controller_manager_config.yaml"

But the generated code in main.go has no support for a -config
flag:

$ ./bin/manager -config foo
flag provided but not defined: -config

What did you expect to see?

I expected the generated manager to have support for the -config
flag, since it is used in the generated manifests.

Environment

Operator type:

/language go

Kubernetes cluster type:

OpenShift

$ operator-sdk version

operator-sdk version: "v1.22.0", commit: "9e95050a94577d1f4ecbaeb6c2755a9d2c231289", kubernetes version: "1.24.1", go version: "go1.18.3", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.18beta1 linux/amd64

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:58:47Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.3+b93fd35", GitCommit:"3a0f2c90b43e6cffd07f57b5b78dd9f083e47ee2", GitTreeState:"clean", BuildDate:"2022-02-11T05:26:59Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}
@openshift-ci openshift-ci bot added the language/go Issue is related to a Go operator project label Jun 18, 2022
@camilamacedo86
Copy link
Contributor

camilamacedo86 commented Jun 21, 2022

Did you scaffold the project using this option operator-sdk init --component-config ?
To know how to use the Component Config I'd like to recommend you follow up on the tutorial: https://book.kubebuilder.io/component-config-tutorial/tutorial.html (you can replace all kubebuilder commands by operator-sdk )

@larsks
Copy link
Author

larsks commented Jun 21, 2022

I did not use --compoment-config. Just running the init command straight from the documentation...

$ operator-sdk init --domain example.com --repo github.com/example/memcached-operator

...is sufficient to generate a configuration that uses the -config option:

$ grep -r -- -config .
...
config/default/manager_config_patch.yaml:        - "--config=controller_manager_config.yaml"
...

If the boilerplate code doesn't support -config, it shouldn't be referenced in the manifests.

@camilamacedo86
Copy link
Contributor

I agree. It shows for me seems a bug.
We probably should only scaffold the file if/when the option is informed in the init command
Also, we could add on the file a comment with the link for its tutorial.

It needs to be addressed on the Kubebuilder.

@jberkhahn
Copy link
Contributor

Hey @camilamacedo86 could you file an issue about this upstream on Kubebuilder, and then close this issue?

@camilamacedo86
Copy link
Contributor

Please see that it was tracked in Kubebuilder: kubernetes-sigs/kubebuilder#2782
Feel free to follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/go Issue is related to a Go operator project
Projects
None yet
Development

No branches or pull requests

3 participants