Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim cluster name & namespace name #53

Closed
max-lobur opened this issue May 22, 2018 · 6 comments
Closed

Trim cluster name & namespace name #53

max-lobur opened this issue May 22, 2018 · 6 comments

Comments

@max-lobur
Copy link

max-lobur commented May 22, 2018

For long cluster names & namespaces it takes a lot of space in a prompt:
(kubernetes.us-west-2.dev.subenv.company.domain:application.namepsace)~prompt$

Two options can be introduced:

  • namespace trim len
  • cluster trim len

setting both to 10 will end to:
(kube.us-we..:applicatio..)~prompt$
default: -1 (no trim)

@jonmosco
Copy link
Owner

For the cluster, you can do a rename (alias) with kubectl:
kubectl config rename-context old_name new_name

For the namespace, you can set up an alias in your dotfiles if necessary, but I dont want to get into limiting the name to a character limit; these names can provide a lot of information and you can always do an alias if necessary.

my_kube_ps1_alias() {
case $1 in
super-long-name) echo short;;
*) echo $1;;
esac
}

PS1='\u @ \h $(my_kube_ps1_alias $KUBE_PS1_CONTEXT) $>'

Check #24 as well.

@max-lobur
Copy link
Author

Interesting. Thanks

@max-lobur
Copy link
Author

max-lobur commented May 22, 2018

these names can provide a lot of information - I know, that's why I propose an option (disabled by default). For our env with lots of clusters I always know that 1st 10 chars will show where am I, so I would use it.

@jonmosco
Copy link
Owner

jonmosco commented May 22, 2018 via email

@max-lobur
Copy link
Author

Should work for me

@jonmosco
Copy link
Owner

Great, thanks for using this prompt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants