kubernetes-sigs / kubernetes-sigs/controller-runtime
flag redefined: kubeconfig: allow double vendoring this library but still register flags on behalf of users
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3k
- Forks
- 1.3k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 14
Description
Error:
/var/folders/3d/_kgky9bj61g5144z004y51qr0000gp/T/go-build652443801/b001/e2e.test flag redefined: kubeconfig
panic: /var/folders/3d/_kgky9bj61g5144z004y51qr0000gp/T/go-build652443801/b001/e2e.test flag redefined: kubeconfig
goroutine 1 [running]:
flag.(*FlagSet).Var(0xc0000d2120, 0x244c6a0, 0xc00004e250, 0x224908b, 0xa, 0x225fced, 0x12)
/usr/local/Cellar/go/1.13.8/libexec/src/flag/flag.go:848 +0x4ae
flag.(*FlagSet).StringVar(...)
/usr/local/Cellar/go/1.13.8/libexec/src/flag/flag.go:751
github.com/operator-framework/operator-sdk/pkg/test.(*frameworkOpts).addToFlagSet(0xc00004e240, 0xc0000d2120)
/Users/akoserwa/go/pkg/mod/github.com/operator-framework/operator-sdk@v0.15.1/pkg/test/framework.go:102 +0x1bf
github.com/operator-framework/operator-sdk/pkg/test.MainEntry(0xc00040d280)
/Users/akoserwa/go/pkg/mod/github.com/operator-framework/operator-sdk@v0.15.1/pkg/test/main_entry.go:27 +0x50
github.com/atlasmap/atlasmap-operator/test/e2e.TestMain(...)
_testmain.go:42 +0x136
Using :-
framework “github.com/operator-framework/operator-sdk/pkg/test” where it is setting
> flagset.StringVar(&opts.kubeconfigPath, KubeConfigFlag, “”, “path to kubeconfig”)
And in my test case, I am using a library which is also using controller-runtime/operator-sdk
github.com/RHsyseng/operator-utils/pkg/utils/openshift
Method I am calling: openshift.IsOpenShift(framework.KubeConfig)
controller-runtime/pkg/client/config/config.go
// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
flag.StringVar(&kubeconfig, “kubeconfig”, “”,
“Paths to a kubeconfig. Only required if out-of-cluster.“)
I suspect fixing TODO will resolve it? If yes, I would like to work on it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with controller-runtime/pkg/client/config/config.go and read the TODO and kubeconfig flag registration shown in the issue. Reproduce the flag redefined: kubeconfig failure with double-vendored dependencies, then determine how registration should behave while still registering flags for users; done means the duplicate registration no longer panics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100