A ZSH plugin to ensure the --context flag is passed to various Kubernetes commands like kubectl, cilium, stern, and more.
- Clone the repository:
git clone --depth=1 \
https://github.com/do-i-need-a-username/ensure-kube-context.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/ensure-kube-context- Configure your .zshrc:
Open ~/.zshrc and set ENSURE_KUBE_CONTEXT_MODULES to a list of commands you want to enforce the --context flag on.
# .zshrc
ENSURE_KUBE_CONTEXT_MODULES=(kubectl cilium stern helm kustomize)- Enable the plugin:
Add ensure-kube-context to the plugins list in your ~/.zshrc file:
plugins=(... ensure-kube-context)- Apply changes:
Source your ~/.zshrc file to apply the changes:
source ~/.zshrcOnce installed and configured, the plugin will automatically ensure that the --context flag is passed to the specified commands.
If you’d like to contribute to this project, please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License.