A custom Powerline segment for displaying the current Kubernetes context and namespace
Project description
A custom Powerline segment for displaying the current Kubernetes context and namespace.
Installation
Using pip
$ pip install powerline-k8s
Configuration
Colorscheme
Add the following config items to your Powerline colorscheme config file (usually located at ~/.config/powerline/colorschemes/),
see Powerline Colorschemes for more info.
{
"k8s": { "fg": "solarized:blue", "bg": "solarized:base02", "attrs": [] },
"k8s_namespace": { "fg": "solarized:red", "bg": "solarized:base02", "attrs": [] },
"k8s_context": { "fg": "solarized:blue", "bg": "solarized:base02", "attrs": [] },
"k8s:divider": { "fg": "gray4", "bg": "solarized:base02", "attrs": [] }
}
Segment
Add the following config item to your Powerline segments config file, see Powerline Segment reference for more info.
{
"function": "powerline_k8s.k8s",
"priority": 30
}
- If adding the segment to the shell, edit
~/.config/powerline/themes/shell/default.json. - If adding the segment to the tmux status line, edit
~/.config/powerline/themes/tmux/default.json.
Alternative config location
If your Kubernetes config file is not in the default location ~/.kube/config, you can point to it by setting
the value of the $KUBECONFIG environment variable to where your config file is.
Toggle visibility
Toggle entire segment or specific section's visibility with the following environment variables:
POWERLINE_K8S_SHOWPOWERLINE_K8S_SHOW_NS
Note: Full segment visibility takes precedence over namespace section visibility.
# toggle segment visibility
$ POWERLINE_K8S_SHOW=0 powerline-daemon --replace # hide powerline-k8s segment
$ POWERLINE_K8S_SHOW=1 powerline-daemon --replace # show powerline-k8s segment (default)
# toggle namespace section visibility
$ POWERLINE_K8S_SHOW_NS=0 powerline-daemon --replace # hide namespace section
$ POWERLINE_K8S_SHOW_NS=1 powerline-daemon --replace # show namespace section (default)
Alternatively you can add the following function to your shell for easier toggling:
toggle_powerline_k8s() {
case "$1" in
# pass the '-ns' flag to toggle namespace visibility
"-ns" | "--namespace")
if [[ "${POWERLINE_K8S_SHOW_NS:-1}" -eq 1 ]]; then
export POWERLINE_K8S_SHOW_NS=0
else
export POWERLINE_K8S_SHOW_NS=1
fi
;;
*)
# toggle segment visibility
if [[ "${POWERLINE_K8S_SHOW:-1}" -eq 1 ]]; then
export POWERLINE_K8S_SHOW=0
else
export POWERLINE_K8S_SHOW=1
fi
;;
esac
}
Demo
Stats
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powerline_k8s-1.5.4.tar.gz.
File metadata
- Download URL: powerline_k8s-1.5.4.tar.gz
- Upload date:
- Size: 37.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c491b88f3cb872720e38f5890565f6f1c93f228a51f52174ee486a30417807d
|
|
| MD5 |
5c8b3cc7ce902843472fd8b18014cb4d
|
|
| BLAKE2b-256 |
00701b9640870220b437c919753a485fb465e3d77325588f057f839ebc9d3bfc
|
Provenance
The following attestation bundles were made for powerline_k8s-1.5.4.tar.gz:
Publisher:
pypi-publish.yml on j4ckofalltrades/powerline-k8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerline_k8s-1.5.4.tar.gz -
Subject digest:
4c491b88f3cb872720e38f5890565f6f1c93f228a51f52174ee486a30417807d - Sigstore transparency entry: 245631303
- Sigstore integration time:
-
Permalink:
j4ckofalltrades/powerline-k8s@8ee093f25d3d6515db6d28d41d8e4a935f2845c1 -
Branch / Tag:
refs/tags/v1.5.4 - Owner: https://github.com/j4ckofalltrades
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@8ee093f25d3d6515db6d28d41d8e4a935f2845c1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file powerline_k8s-1.5.4-py3-none-any.whl.
File metadata
- Download URL: powerline_k8s-1.5.4-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1db3fb31e029b68643fd939a61ec62baf7314f4eb316a3dd6eebf2317f305634
|
|
| MD5 |
ca6a554f9355c105fbf393497e5e4fb3
|
|
| BLAKE2b-256 |
f65bfed883f1f2dca7f4a11990c7ecb8ba552dde6ac79066b8196ef67b75ca24
|
Provenance
The following attestation bundles were made for powerline_k8s-1.5.4-py3-none-any.whl:
Publisher:
pypi-publish.yml on j4ckofalltrades/powerline-k8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerline_k8s-1.5.4-py3-none-any.whl -
Subject digest:
1db3fb31e029b68643fd939a61ec62baf7314f4eb316a3dd6eebf2317f305634 - Sigstore transparency entry: 245631305
- Sigstore integration time:
-
Permalink:
j4ckofalltrades/powerline-k8s@8ee093f25d3d6515db6d28d41d8e4a935f2845c1 -
Branch / Tag:
refs/tags/v1.5.4 - Owner: https://github.com/j4ckofalltrades
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@8ee093f25d3d6515db6d28d41d8e4a935f2845c1 -
Trigger Event:
push
-
Statement type: