k8
2 years ago in Shell
#!/bin/bash
#https://github.com/lensapp/lens/issues/2021
shopt -s expand_aliases
alias kubectlens="/usr/local/bin/kubectl"
LENS_CONTEXT=$(kubectlens config current-context)
echo "Lens Context: $LENS_CONTEXT"
export KUBECONFIG=""
DEFAULT_CONTEXT=$(kubectlens config current-context)
echo "Default Context: $DEFAULT_CONTEXT"
kubectlens config use-context "$LENS_CONTEXT"
(sleep 1 && kubectlens config use-context "$DEFAULT_CONTEXT" >> /dev/null) &
kubectlens "$@"