-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
merge multiple files listed in KUBECONFIG environment var #6240
Comments
I am working on a patch as this configuration/setup looks rather common when a user has lots of clusters. It allows a user to split up the configuration into smaller chunks rather to have a single big kube config. |
Patch seems rather simple (just looking, didnt code so far): |
For my own documentation:
that are found in the additional files. |
@adietish : I'm sorry for replying late, after reading your comment I realized we had merged something similar a few years ago. However, I'm not sure whether it's completely aligned with |
@rohanKanojia thx for the pointer, I had already looked into this. This PR only takes the 1st of the given files into account. All further ones are ignored. See here: https://github.com/fabric8io/kubernetes-client/pull/1306/files#diff-ee58b9555742a6e84ec59a74115410be46af05081afae5cf79a4516283ce37c7R444 LOGGER.warn("Found multiple Kubernetes config files [{}], using the first one: [{}].
If not desired file, please change it by doing `export KUBECONFIG=/path/to/kubeconfig` on Unix systems
or `$Env:KUBECONFIG=/path/to/kubeconfig` on Windows.", fileNames, fileNames[0]); What I want to improve is to allow several files to be used. In quarkusio/quarkus#8946 (comment) @manusa brought up how such a setup would work:
redhat-developer/intellij-kubernetes#779 provides an exemplary setup where the 1st file sets the |
This seems fine. Implementation should be quite easy for merging. |
@manusa thx for the pointer, I found Lines 188 to 225 in 342fb8a
|
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
I have to specify my suggestion in #6240 (comment) according to the Kubectl docs:
And then, when using
|
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
Signed-off-by: Andre Dietisheim <[email protected]>
* update token in file listed in KUBECONFIG env var (fabric8io#6240) * only parse configs once (fabric8io#6240) * update file with auth info when merging authinfos * parametrized KubeConfigUtilsTest for #hasAuthInfoNamed * expose Config#getFileWithCurrentContext & #getFileWithContext to consumers Signed-off-by: Andre Dietisheim <[email protected]>
* update token in file listed in KUBECONFIG env var (fabric8io#6240) * only parse configs once (fabric8io#6240) * update file with auth info when merging authinfos * parametrized KubeConfigUtilsTest for #hasAuthInfoNamed * expose Config#getFileWithCurrentContext & #getFileWithContext to consumers Signed-off-by: Andre Dietisheim <[email protected]>
* update token in file listed in KUBECONFIG env var (fabric8io#6240) * only parse configs once (fabric8io#6240) * update file with auth info when merging authinfos * parametrized KubeConfigUtilsTest for #hasAuthInfoNamed * expose Config#getFileWithCurrentContext & #getFileWithContext to consumers Signed-off-by: Andre Dietisheim <[email protected]>
* update token in file listed in KUBECONFIG env var (fabric8io#6240) * only parse configs once (fabric8io#6240) * update file with auth info when merging authinfos * parametrized KubeConfigUtilsTest for #hasAuthInfoNamed * expose Config#getFileWithCurrentContext & #getFileWithContext to consumers Signed-off-by: Andre Dietisheim <[email protected]>
* update token in file listed in KUBECONFIG env var (fabric8io#6240) * only parse configs once (fabric8io#6240) * update file with auth info when merging authinfos * parametrized KubeConfigUtilsTest for #hasAuthInfoNamed * expose Config#getFileWithCurrentContext & #getFileWithContext to consumers Signed-off-by: Andre Dietisheim <[email protected]>
… var (6295) use kubeconfigs listed in KUBECONFIG env var (#6240) * update token in file listed in KUBECONFIG env var (#6240) * only parse configs once (#6240) * update file with auth info when merging authinfos * parametrized KubeConfigUtilsTest for #hasAuthInfoNamed * expose Config#getFileWithCurrentContext & #getFileWithContext to consumers Signed-off-by: Andre Dietisheim <[email protected]> --- review(config): support for multiple files listed in the KUBECONFIG env var Signed-off-by: Marc Nuri <[email protected]> Co-authored-by: Marc Nuri <[email protected]>
Is your enhancement related to a problem? Please describe
One can provide kubectl with multiple kube config files via the
KUBECONFIG
env variable. Kubectl would merge those and let the user use them.ex.
export KUBECONFIG=${HOME}/.kube/config:${HOME}/.kube/minikube.yaml:${HOME}/.kube/sandbox.yaml
~/.kube/config
with onlycurrent-context
pointing to a context that's defined in further file~/.kube/minikube.yml
~/.kube/sandbox.yml
In kubectl I can then have
config
pointing to minikube or sandbox, both would work. In kubernetes-client, only the 1st file is used which then fails because it is missing url, user, etc.Describe the solution you'd like
It would be great if kubernetes-client could merge these files into one config like kubectl does.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: