浏览代码

allow kubectl commands against all namespaces (#7637)

* allow kubectl commands against all namespaces

* enhance the readme too
Ulrich Schreiner 6 年之前
父节点
当前提交
275e5b1349
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. 1 0
      plugins/kubectl/README.md
  2. 3 0
      plugins/kubectl/kubectl.plugin.zsh

+ 1 - 0
plugins/kubectl/README.md

@@ -14,6 +14,7 @@ plugins=(... kubectl)
 | Alias   | Command                             | Description                                                                                      |
 | Alias   | Command                             | Description                                                                                      |
 |:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------|
 |:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------|
 | k       | `kubectl`                           | The kubectl command                                                                              |
 | k       | `kubectl`                           | The kubectl command                                                                              |
+| kca     | `kubectl --all-namespaces`          | The kubectl command targeting all namespaces                                                     |
 | kaf     | `kubectl apply -f`                  | Apply a YML file                                                                                 |
 | kaf     | `kubectl apply -f`                  | Apply a YML file                                                                                 |
 | keti    | `kubectl exec -ti`                  | Drop into an interactive terminal on a container                                                 |
 | keti    | `kubectl exec -ti`                  | Drop into an interactive terminal on a container                                                 |
 |         |                                     | **Manage configuration quickly to switch contexts between local, dev and staging**               |
 |         |                                     | **Manage configuration quickly to switch contexts between local, dev and staging**               |

+ 3 - 0
plugins/kubectl/kubectl.plugin.zsh

@@ -13,6 +13,9 @@ fi
 # This command is used a LOT both below and in daily life
 # This command is used a LOT both below and in daily life
 alias k=kubectl
 alias k=kubectl
 
 
+# Execute a kubectl command against all namespaces
+alias kca='f(){ kubectl "$@" --all-namespaces;  unset -f f; }; f'
+
 # Apply a YML file
 # Apply a YML file
 alias kaf='kubectl apply -f'
 alias kaf='kubectl apply -f'