Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kubernetes: add current context and namespace for kubernetes
- Loading branch information
1 parent
972880e
commit 54082a7
Showing
4 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# kubernetes | ||
|
||
Show the kubernetes current context and namespace in use. This is usefull when you are operating multiple kube clusters and/or namespaces. | ||
|
||
![](kubernetes.png) | ||
|
||
# Dependencies | ||
|
||
*kubectl* must be install and accessible under your *$PATH* | ||
|
||
# Config | ||
|
||
``` | ||
[kubernetes] | ||
command=$SCRIPT_DIR/kubernetes | ||
interval=10 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[kubernetes] | ||
command=$SCRIPT_DIR/kubernetes | ||
interval=10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
KCONTEXT=$(kubectl config current-context 2>/dev/null) | ||
if [[ $?=="0" ]]; then | ||
CC=$(kubectl config view -ojsonpath='{..current-context}') | ||
KNAMESPACE=$(kubectl config view -ojsonpath="{.Contexts[?(@.Name==\"$CC\")]..namespace}") | ||
echo "☸ $KCONTEXT/$KNAMESPACE ☸" | ||
echo "☸ $KCONTEXT/$KNAMESPACE ☸" | ||
echo \#4040FF # color | ||
fi | ||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.