powerline-kubernetes icon indicating copy to clipboard operation
powerline-kubernetes copied to clipboard

Very long contexts when using with OpenShift

Open bliemli opened this issue 7 years ago • 4 comments

When using powerline-kubernetes with OpenShift, the context part usually gets very long, e.g.:

⎈ explore-00/master-asdf-openshift3roadshow-com:443/user00 - explore-00

A config parameter permitting to either only display the namespace or the context would be great.

bliemli avatar Mar 30 '17 13:03 bliemli

Sorry I hadn't seen this issue until just now. I'll have a look into this - thanks for suggestion.

for me, I can manage my context and namespace names as I'm working with k8s directly (and just use kubectl config set-context with the desired name), but a feature toggle what you want to display or trim either field isn't a bad idea.

If trimming, should it chop off in the front or the end?

so0k avatar Apr 24 '17 01:04 so0k

Thanks for writing back. I just realized ... config set-context works for oc as well. But to answer your question: When working with OpenShift, the interesting part in the above example would simply be explore-00 in a lot of use cases. This corresponds to the NAMESPACE part of the get-context output. So maybe an idea would be to allow toggling the different fields of the get-context output, in my case:

$ oc config get-contexts 
CURRENT  NAME  CLUSTER  AUTHINFO  NAMESPACE
...

(where CURRENT doesn't contain any useful information and could probably be left out anyway). So if I wanted to only display the NAMESPACE part I'd toggle off all other parts and only allow NAMESPACE.

bliemli avatar Apr 25 '17 20:04 bliemli

@bliemli I think @so0k took care of this with more recent updates that let you toggle whether the context and/or namespace get added.

kungfuchicken avatar Nov 05 '19 05:11 kungfuchicken

Hi.

Why does not adds "cluster" as a new parameter? It would be easier in most of the situation to have just that instead of the context, particularly with OpenShift.

Just adding

cluster = ctx['cluster']

And the corresponding references.

rgordill avatar Mar 02 '20 23:03 rgordill