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

Add option for propagating environment variables #110

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

psibi
Copy link

@psibi psibi commented Dec 2, 2022

Right now, kubel works when the apropriate credential is part of ~/.kube. But it doesn't work,if I have KUBECONFIG environment variable pointing out to somewhere else (basically if it's not globally set). If you use something like direnv to have project specific environment variable, kubel doesn't work there. And at work, I usually have separate clusters each being managed in their own directory.

This PR adds supports for propagating environment variables and making kubel working in those environment. For EKS cluster, I have to often propagate some extra environment variables to make it work with kubel:

(kubel-env-variables (list "KUBECONFIG" "AWS_ACCESS_KEY_ID" "AWS_SECRET_ACCESS_KEY"))

kubel.el Outdated Show resolved Hide resolved
(with-output-to-string
(with-current-buffer standard-output
(shell-command cmd t "*kubel stderr*"))))
(let ((env-values (kubel--env-values)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the only place where you need to do that? what about kubel--exec?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only place where it was required for me to unblock it and have a working kubel version in my envrc based setup.

Note that it still isn't perfect and has some shortcomings which I plan to address in a subsequent PR. But I believe those changes are going to be slightly big (I have a working copy locally, but I'm still testing out various scenarios).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect things are going to be very wonky if the changes are only applied to this function and not also kubel--exec

@abrochard
Copy link
Owner

Thank you for submitting this! I left a few comments. Could you also please update the doc to show intended usage?

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 this pull request may close these issues.

None yet

2 participants