-
Notifications
You must be signed in to change notification settings - Fork 5
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
default-context and default-namespace not working as intended? #63
Comments
Hmmm....I'm not at home right now to test this out but do you not have a default yaml under .kube/config? Sort of a master config file? If not, how does it work for you to set context when using kubectl? If you run this command: The idea (if there is no bug), is that we assume you have a default My confusion is mostly because we actually avoid changing any files that kubesess doesn't own ( My assumption is that if the above command works, it should work for us as well since that's how we set it. |
I ported over from using kubectx and previously I just had all my various kubeconfig files in a directory
But even when I have a file at
I get the same result, using I can switch with |
Does the change persist between shell when you do kubectl use-context? |
Yes using use-context it persists across shells. Should
|
I have a fix for your use case but want to work on it a bit more since my idea for the auto include configs won't work well with it. The problem (with the fix) is that it would require everyone to have a similar env variable as you have . Will try to get it fixed today! |
I did not have time to do it the proper way, this should work for you I think, if it doesn't just reopen this issue! |
Thank you very much. I'll check it out as soon as there's a release. Or if you want I can test it from source? Just unsure as to how I should build and test the tool locally. |
It's released! |
Verified that it's working here as well, many thanks! |
Describe the bug
For me,
kcd
andknd
are not working properly and I also don't see how they should work?Kubesess prepends the active kubeconfig from
kubesess/cache
to the $KUBECONFIG env variable, default-context should work across different shells but when I create a new one it defaults to the first in the list.Because to persist the list of configs you add it to
.bashrc
or.zshrc
, creating a new shell reinitializes theKUBECONFIG
variable, so the prepended config is lost.I also tried using option 2 of using multiple config files as described in readme (all config plain in
.kube
folder and let kubesess handle it, but I still get the same issue.So it seems to me that one should add something default setting of
KUBECONFIG
in.zshrc
to get a working default context no?Something like
which doesn't work because cache only gets used when you set a namespace.
Am I missing some environment variable which kubesess sets pointing to the default context/namespace?
To Reproduce
kcd
and choose a contextExpected behavior
When setting default context, all new shells will default to this context
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: