jonmosco / kube-ps1

Kubernetes prompt info for bash and zsh
Apache License 2.0
3.52k stars 351 forks source link

feat: Add KUBE_EKS_SHORT_MODE as a quick way to display cluster name #182

Closed tweeks-reify closed 7 months ago

tweeks-reify commented 1 year ago

A quick QOL PR to remove the arn from EKS clusters by using an env var to keep the CLI prompt short.

PS1='$(kube_ps1)'$PS1

(⎈|arn:aws:eks:us-east-1:<account>:cluster/cluster-use1-sandbox01:default)➜ ~

KUBE_EKS_MODE_ENABLED=true PS1='$(kube_ps1)'$PS1

(⎈|cluster-use1-sandbox01:default)➜ ~

jonmosco commented 7 months ago

Thanks for the PR. This would be a good fit for the available functions: https://github.com/jonmosco/kube-ps1?tab=readme-ov-file#customize-display-of-cluster-name-and-namespace

Also, I usually script the long names for other k8s platforms as well (eg, OpenShift: oc config rename-context $(oc config current-context) aws-short-name).