-
Notifications
You must be signed in to change notification settings - Fork 60
Support KUBECONFIG
environment variable
#3383
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 KUBECONFIG
environment variable
#3383
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3383 +/- ##
==========================================
+ Coverage 35.64% 35.68% +0.03%
==========================================
Files 79 79
Lines 5549 5571 +22
Branches 1092 1096 +4
==========================================
+ Hits 1978 1988 +10
- Misses 3571 3583 +12
☔ View full report in Codecov by Sentry. |
0e2f5fe
to
95a46fe
Compare
@datho7561 If I set KUBECONFIG env. variable to point to some Kube config other that the default one - should the Kube config from that env. variable to be used and shown in Application Explorer? In case of multiple Kube configs set in the env. variable I get Application Explorer "broken" not allowing to login to cluster... Shouldn't we use a Kube config defined in KUBECONFIG env. variable (or pick up the first one if multiple set) to access a cluster? UPD: The multiple Kube configs problem probably is not a relevant one - it happened because I actually copied the same config file several times. But OS Tools had never told me about the problems happened during the configuration files loading and data merging... vscode-openshift-tools/src/util/kubeUtils.ts Lines 28 to 30 in 5ba235c
|
I'll fix the tree item that displays the current kubeconfig file so that it respects the environment variable. The library we are using to read the Kubeconfig doesn't handle merging Kubeconfigs when there are multiple ones specified. What path forward makes the most sense to you:
Either way, it should warn you if you use the "Multiple KUBECONFIG" feature. I'll double check this usecase. |
@datho7561 I think we should follow the way the library does it. If we can point which Kube config to be used by the library - let's load the only that config - we don't need the others if they're not going to be used. (And in this case we probably can add a selector preference to allow users to change to a different config from the list of the ones defined in KUBECONFIG env. variable) If the library gets a config not directly from a Kube config file but, for example, as a json-like input, then probably we should merge all the configs specified in KUBECONFIG env. variable (notifying users on all possible problems) and provide the result to the library. Honestly I don't know yet how is that library used and initialized with data so, it's hard to make a choice for me here.
This warning appeared for me with no problem - I was warned on using multiple configs when more than one config file was set up in KUBECONFIG env. variable. |
95a46fe
to
47ebefc
Compare
I pushed a new commit that forces the user to pick one of the KUBECONFIG files if there are multiple when the extension starts. I'm not sure how to feel about this, since (unless we do a large refactor) we need to block the rest of the extension from starting until the user selects the file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
The contexts are loaded only from a user selected config file in case of multiple configs are provided through the KUBECONFIG environment variable.
- Watch for changes in file(s) indicated by `KUBECONFIG` when it's set - Force users to pick one file when multiple config files are specified in `KUBECONFIG`, since the Kubernetes client library we are using doesn't support using multiple files Closes redhat-developer#3382 Signed-off-by: David Thompson <[email protected]>
42f0290
to
fee0cf2
Compare
KUBECONFIG
when it's setKUBECONFIG
, since the Kubernetes client library we are using doesn't support this use caseCloses #3382
Signed-off-by: David Thompson [email protected]