From 20333b1b28d394eb5ef3341c0dbaf8183e0e55d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Mar 2019 13:27:28 +0100 Subject: zsh: Add kubernetes release detection --- zsh/.config/zsh/.zshrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 0f7b014..ce28d65 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -218,8 +218,22 @@ else check_kubectl_context () { if [[ "$PWD" =~ /kubernetes ]] then + git_branch=$(git rev-parse --abbrev-ref HEAD) kubectl_context=$(kubectl config current-context) kubectl_namespace=$(kubectl config view -o jsonpath="{.contexts[?(@.name==\"${kubectl_context}\")].context.namespace}") + case $git_branch in + staging) + kubectl_release=satoshipay-${kubectl_namespace}-staging + ;; + production) + kubectl_release=satoshipay-${kubectl_namespace} + ;; + master) + kubectl_release= + ;; + *) + kubectl_release=story-${git_branch}-${kubectl_namespace} + esac if [[ $kubectl_context =~ production ]] then kubectl_colour=red -- cgit 1.4.1