From 0d927a66dd793e15cd24294ab9f0a7c8b9953e9c Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Sun, 21 May 2023 15:15:49 +0200 Subject: Add kontext --- kontext.in | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 kontext.in (limited to 'kontext.in') diff --git a/kontext.in b/kontext.in new file mode 100755 index 0000000..a16798a --- /dev/null +++ b/kontext.in @@ -0,0 +1,51 @@ +#!@ENV_ABSOLUTE_PATH@ bash + +[[ "${BASH_SOURCE[0]}" != "${0}" ]] || { >&2 cat <] []" + Switch to the given namespace and context. + +More information may be found in the kontext(1) man page. +EOF + return 1 + else + TMP_KUBECONFIG=$(mktemp -t kubeconfig-XXXXXX) + kubectl config view --raw > "$TMP_KUBECONFIG" + export KUBECONFIG="$TMP_KUBECONFIG" + kubectl config use-context "$CTX" && \ + kubectl config set-context --current --namespace="$NAMESPACE" + fi +} + +kontext_func "$@" -- cgit v1.2.3