Skip to content

how to periodically update segment for K8s info output ? #282

Answered by erikw
gkoenig asked this question in Q&A
Discussion options

You must be logged in to vote

The way environmental variables and shells works is that a change of an envvar is local to the current shell. tmux-powerline works in a different shell than the one you changed $KUBECONFIG in. Thus, there must be some way to inform tmux-powerline on which value of $KUBECONFIG should be used.

Two ideas to solve this would be:

  1. Let your segment read the value from a state file like ~/.kubeconfig. Instead of changing the envvar in your shell, you write the current value to a file. To make this easy, you can make a shell function that you source or include in your shell startup file like
    *
    kubeconfig() {
     local value="$1"
     export KUBECONFIG="$value"
     echo "$value" > $HOME/.kubeconfig
    }
    • Then …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gkoenig
Comment options

@erikw
Comment options

Answer selected by erikw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants