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

Presets for kubeconfig files #119

Open
pashazz opened this issue Nov 3, 2023 · 1 comment
Open

Presets for kubeconfig files #119

pashazz opened this issue Nov 3, 2023 · 1 comment

Comments

@pashazz
Copy link

pashazz commented Nov 3, 2023

So I have different clusters and different KUBECONFIG files for each cluster: my work clusters, production, and home kind clusters they all have different kubeconfigs.

I wonder if I'd be able to maybe provide a list of kubeconfig files and then hit some button and circle through them?

Now I feel I only can hit K and choose KUBECONFIG file from my directory structure each time I launch Emacs

@abrochard
Copy link
Owner

Hi @pashazz ,
I gave this some thought and I think the simplest at this point is for you to customize the kubel-set-kubectl-config-file function with an advice. I did some local testing and I think something like

(defconst my-kubeconfig-files '("LIST" "OF" "FILEPATHS"))

(defun set-my-kubeconfig-files (set-config-file)
    (funcall set-config-file (completing-read "Select kubeconfig file: " my-kubeconfig-files)))

(advice-add 'kubel-set-kubectl-config-file :around #'set-my-kubeconfig-files)

I used the official doc as a guide https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html but in short my understanding is that you override the kubel-set-kubectl-config-file with the custom function set-my-kubeconfig-files, which has the presets of your kubeconfig files, lets you select one, and then passes it to the old kubel-set-kubectl-config-file

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

No branches or pull requests

2 participants