client-go: Can't override config values
I am loading my local kubeconfig which contains multiple clusters and contexts. The default context is “prod” and one of the config values I want to override is the CurrentContext
clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
&clientcmd.ClientConfigLoadingRules{ExplicitPath: "/Users/me/.kube/config"},
&clientcmd.ConfigOverrides{
CurrentContext: "stage",
})
rawConfig, _ := clientConfig.RawConfig()
log.Printf(rawConfig.CurrentContext) // outputs "prod" instead of "stage"
When I inspect RawConfig() the current context is still “prod” instead of “stage”.
Why does the config override not work?
Also how does the override for AuthInfo etc. work? The override accepts only a single AuthInfo whereas the configuration contains a map of AuthInfo etc.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 18 (6 by maintainers)
@bioball: You can’t reopen an issue/PR unless you authored it or you are a collaborator.
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.