ensure kubecontext namespace is not empty

This commit is contained in:
romkatv 2019-07-30 09:38:27 +02:00
parent 32421d296c
commit 7cf4f7e57d

View file

@ -2918,6 +2918,7 @@ prompt_kubecontext() {
done done
} }
if [[ -n $name ]]; then if [[ -n $name ]]; then
: ${namespace:=default}
# gke_my-account_us-east1-a_cluster-01 # gke_my-account_us-east1-a_cluster-01
if [[ $cluster == (#b)gke_(?*)_(asia|australia|europe|northamerica|southamerica|us)-([a-z]##<->-[a-z])_(?*) ]]; then if [[ $cluster == (#b)gke_(?*)_(asia|australia|europe|northamerica|southamerica|us)-([a-z]##<->-[a-z])_(?*) ]]; then
cloud_name=gke cloud_name=gke
@ -2939,9 +2940,8 @@ prompt_kubecontext() {
fi fi
if [[ -z $text ]]; then if [[ -z $text ]]; then
text=$name text=$name
local ns=${namespace:-default} if [[ $_POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE == 1 || $namespace != (default|$name) ]]; then
if [[ $_POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE == 1 || $ns != (default|$name) ]]; then text+="/$namespace"
text+="/$ns"
fi fi
fi fi
local pat class local pat class