275e5b13498e04173f703538bff32fc2c801b4d3

Author
Ulrich Schreiner <ulrich.schreiner@gmail.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

allow kubectl commands against all namespaces (#7637)

* allow kubectl commands against all namespaces

* enhance the readme too

Diff

 1diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
 2index b30f90548d0e1b5bebd58fddf4a7f63b629dda2d..3343f019559a78acac02535f66a2597df6edff9e 100644
 3--- a/plugins/kubectl/README.md
 4+++ b/plugins/kubectl/README.md
 5@@ -14,6 +14,7 @@ plugins=(... kubectl)
 6 | Alias   | Command                             | Description                                                                                      |
 7 |:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------|
 8 | k       | `kubectl`                           | The kubectl command                                                                              |
 9+| kca     | `kubectl --all-namespaces`          | The kubectl command targeting all namespaces                                                     |
10 | kaf     | `kubectl apply -f`                  | Apply a YML file                                                                                 |
11 | keti    | `kubectl exec -ti`                  | Drop into an interactive terminal on a container                                                 |
12 |         |                                     | **Manage configuration quickly to switch contexts between local, dev and staging**               |
13diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
14index d388d654388154ab9492d67691b75dec88eb34b0..ab7a1a0a44b79726c191bdb0c1e1fd3d0c25161e 100644
15--- a/plugins/kubectl/kubectl.plugin.zsh
16+++ b/plugins/kubectl/kubectl.plugin.zsh
17@@ -13,6 +13,9 @@ fi
18 # This command is used a LOT both below and in daily life
19 alias k=kubectl
20 
21+# Execute a kubectl command against all namespaces
22+alias kca='f(){ kubectl "$@" --all-namespaces;  unset -f f; }; f'
23+
24 # Apply a YML file
25 alias kaf='kubectl apply -f'
26