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

Support for multiple values in KUBECONFIG variable #2174

Closed
rohanKanojia opened this issue Apr 29, 2020 · 2 comments · Fixed by #2181
Closed

Support for multiple values in KUBECONFIG variable #2174

rohanKanojia opened this issue Apr 29, 2020 · 2 comments · Fixed by #2181

Comments

@rohanKanojia
Copy link
Member

We need to check how the client is handling the case when KUBECONFIG variable has multiple values. If present, we should print a warning about which kubeconfig did we read for client operations.

Orignal issue: quarkusio/quarkus#8946

@rohanKanojia
Copy link
Member Author

@manusa @iocanel : I checked and looks like multiple values are already being handled:

if (Utils.getSystemPropertyOrEnvVar(KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, true)) {
String fileName = Utils.getSystemPropertyOrEnvVar(KUBERNETES_KUBECONFIG_FILE, new File(getHomeDir(), ".kube" + File.separator + "config").toString());
// if system property/env var contains multiple files take the first one based on the environment
// we are running in (eg. : for Linux, ; for Windows)
String[] fileNames = fileName.split(File.pathSeparator);
if (fileNames.length > 1) {
LOGGER.debug("Found multiple Kubernetes config files [{}], using the first one: [{}].", fileNames, fileNames[0]);
fileName = fileNames[0];
}
File kubeConfigFile = new File(fileName);
if (kubeConfigFile.isFile()) {
LOGGER.debug("Found for Kubernetes config at: ["+kubeConfigFile.getPath()+"].");

@manusa
Copy link
Member

manusa commented Apr 30, 2020

😄

So basically to fulfill the AC defined in my comment we just need to change the log level.

rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Apr 30, 2020
Changed loglevel to warn in case of multiple kubeconfig are found in `KUBECONFIG`
environment variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants