abrochard / kubel

Emacs extension for controlling Kubernetes with limited permissions
GNU General Public License v3.0
267 stars 44 forks source link

Add a `kubel-kubectl` option & use it wherever kubectl should be used #81

Closed johnhamelink closed 2 years ago

johnhamelink commented 2 years ago

We use aws-vault to secure access to our Kubernetes cluster. In kubernetes-el, I was able to set kubernetes-kubectl-executable to point to this shell script:

#!/usr/bin/env bash

AWS_PROFILE="production"

/usr/bin/aws-vault exec \
           "${AWS_PROFILE}" \
           --prompt=zenity \
           -- \
           /home/john/.asdf/shims/kubectl "${@}"

This allowed me to run kubectl via aws-vault. I set aws-vault to show a GUI prompt when 2FA details are needed - just to keep things simple.

This PR allows attempts to achieve the same thing with kubel.

This is literally the first time I've ever modified an Emacs package.

abrochard commented 2 years ago

I like the concept, this is definitely valuable. I'm a little too busy these days to help track down that bug, but I'll be happy to review and merge when ready.

johnhamelink commented 2 years ago

I'll keep at it @abrochard!

johnhamelink commented 2 years ago

@abrochard fixed! I had to use a backquote to expose the value of the kubel-kubectl variable to fix the TRAMP issue. I didn't really understand why this was a fix until I found that ,x refers to a "real" variable or value, whereas x is a "meta-variable".

johnhamelink commented 2 years ago

Thank you @abrochard, I've been enjoying using this as an alternative to k9s now for a few weeks, and it's been fairly smooth so far. The TRAMP integration is particularly impressive!

abrochard commented 2 years ago

Thank you! I'm glad it's helpful. We got a lot of help to get to where we are and I think I'm the one who learned the most in the process.