Powerkube-fork
Powerkube-fork is a Powerline segment that shows your current Kubernetes context. It can be configured to show any or all of:
- the current cluster
- the current namespace
- the current user
Two other nifty features that it has are:
- The ability to toggle on or off the powerkube-fork segment using an environment variable which can easily be mapped to a function in your
~/.bash_profile. - The ability to define certain namespaces to be colored differently for alerting purposes. For example, you could have your production namespaces show up in bright red.
The screenshot below demonstrates this functionality:
Installation
- Add the Python package. powerkube-fork is available on pypi so you can install it with pip:
pip install --user powerkube-fork
- Create a user configuration directory.
Once powerkube-fork has been installed, we'll need to add it to our powerline shell's theme and colorscheme.
Alter your powerline user config:
If you don't already have a ~/.config/powerline/ folder, create it. Next we'll be copying some of the default powerline configs into this location. Find where powerline is installed by using pip show powerline-status | grep 'Location', then navigate to the config_files/ folder there. We'll be copying config.json, themes/shell/default.json, and colorschemes/shell/default.json to our ~/.config/powerline/ folder, adding the necessary folders to match that original file structure (i.e. adding the themes/ and colorschemes/ folders, etc.
- Add powerkube-fork to your user config.
Within our user config, we'll need to add the powerkube-fork segment to our shell by adding the following lines to our ~/.config/powerline/themes/shell/default.json:
{
"function": "powerkube_fork.context",
"priority": 30,
"args": {"show_cluster": true,
"show_namespace": true,
"show_user": true,
"alert_namespaces": ["data-prod", "infra-prod"]}
}
Next we'll add the highlighting colors we'll use to our ~/.config/powerline/colorschemes/shell/default.json:
{
"name": "Default",
"groups": {
"kubernetes_cluster": { "fg": "white", "bg": "gray6", "attrs": [] },
"kubernetes_namespace": { "fg": "white", "bg": "gray8", "attrs": [] },
"kubernetes_namespace:alert": { "fg": "white", "bg": "brightred", "attrs": [] },
"kubernetes_user": { "fg": "white", "bg": "gray9", "attrs": [] }
}
}
-
You may need to reload powerline with
powerline-daemon --replaceto load the new settings. That's it! -
(Optional) By default powerkube-fork will render the kubernetes context if the environment variable
RENDER_POWERLINE_KUBERNETESis either set toYESor is not set at all. Rather than setting this variable manually, you can create a simplekshowfunction by placing the following in your~/.bash_profile:
function powerline-kubernetes-toggle() {
if [[ $RENDER_POWERLINE_KUBERNETES = "NO" ]]; then
export RENDER_POWERLINE_KUBERNETES=YES
else
export RENDER_POWERLINE_KUBERNETES=NO
fi
}
You're all set up! Happy coding!
License
Licensed under the Apache License 2.0.
Original fork is at https://github.com/zcmarine/powerkube.
Metadata
Release files for powerkube-fork 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| powerkube-fork-0.2.1.tar.gz | 4.7 kB | Without provenance | Details for powerkube-fork-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| powerkube_fork-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for powerkube_fork-0.2.1-py3-none-any.whl |
Total release size: 13.1 kB
Release files / powerkube-fork-0.2.1.tar.gz
| Download URL | powerkube-fork-0.2.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe9e7526cd7570d8a4caa7a81b74a7d92ad71db18e700f429a442dc61996a9f4
|
|
BLAKE2b-256 checksum How to use checksums |
f32d0ecb68bd61e5fd4bb027a268ae0844a52a62d139984e8d011703156b1333
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.4
|
Release files / powerkube_fork-0.2.1-py3-none-any.whl
| Download URL | powerkube_fork-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94cbf31f1566540556a62de543ca8c29953b39ec7fc36be279397018c6643b11
|
|
BLAKE2b-256 checksum How to use checksums |
cff524d45c5afd88e3c363e5fabb90b14c22f34671435e577e6e7639c8ab18b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.4
|
Security for powerkube-fork 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.