From 008fec04a712b14153d2df2935188e65439a65bb Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Fri, 17 Feb 2023 15:37:29 +0100 Subject: [PATCH] Kctl --- zsh/aliases.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index e3f6dbb..bec1164 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -124,6 +124,22 @@ if [ $? -eq 0 ]; then fi } + # Shortcut for kubectl + kctl() { + local kube_config + if [ -z $KUBECONFIG ]; then + kube_config=$HOME/.kube/config + else + kube_config=$KUBECONFIG + fi + if [ -f $kube_config ]; then + kubectl $@ + else + echo >&2 error: $kube_config does not exist + return 1 + fi + } + fi # change to git directory