kubecontext is not shown if namespace starts by a number
Closed this issue · 2 comments
I guess it is not very common, but we have some namespaces starting by a number (example 3scale-saas
).
If in my k8s context the namespace starts by a number, the kubecontext is not shown when typing any kubectl
/oc
.. command.
If I change the context to any more usual namespace without a number, then it works fine.
Let me show you the output of my kubecontext and the powerlevel config, if I execute:
(
command kubectl config view -o=yaml
typeset -pm '(POWERLEVEL9K|P9K)_KUBECONTEXT_*'
)
I obtain (I've redacted the api url):
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://api.....:6443
name: api-....:6443
contexts:
- context:
cluster: api-....:6443
namespace: 3scale-saas
user: slopezz/api-...:6443
name: 3scale-saas/api-...:6443/slopezz
current-context: 3scale-saas/api-...:6443/slopezz
kind: Config
preferences: {}
users:
- name: slopezz/api-....:6443
user:
token: REDACTED
typeset P9K_KUBECONTEXT_CLOUD_ZONE=''
typeset P9K_KUBECONTEXT_CLUSTER=api-....:6443
typeset POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
typeset P9K_KUBECONTEXT_NAMESPACE=3scale-saas
typeset P9K_KUBECONTEXT_CLOUD_NAME=''
typeset POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold|kubent|kubecolor|cmctl|sparkctl'
typeset P9K_KUBECONTEXT_NAME=3scale-saas/api-.....:6443/slopezz
typeset POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7
typeset P9K_KUBECONTEXT_CLOUD_CLUSTER=''
typeset P9K_KUBECONTEXT_CLOUD_ACCOUNT=''
typeset P9K_KUBECONTEXT_USER=slopezz/api-....:6443
typeset -a POWERLEVEL9K_KUBECONTEXT_CLASSES=( '*' DEFAULT )
typeset POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5
it is a desired behaviour? Possibly and issue with a regex not expecting a namespace starting by a number?
Are you sure it's not shown? Is it possible it's just so long that it does not fit, and therefore right prompt gets hidden? Try moving kubecontext
from POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS
to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
in ~/.p10k.zsh
and see if that makes the segment visible.