945d89f7ae86c740f0e09e94b7baf9b12a384535

Author
NanoNova <kid1412621@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(kubectl): add aliases for kustomization directories (#13033)

Diff

 1diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
 2index 19c36c9910ce30bdaa7e6d3ce61bc5cfae9d0d31..f4b0d6663a5775bdb9d7bf9ef5cabc3fd720cf7c 100644
 3--- a/plugins/kubectl/README.md
 4+++ b/plugins/kubectl/README.md
 5@@ -16,6 +16,7 @@ plugins=(... kubectl)
 6 | k        | `kubectl`                                               | The kubectl command                                                                              |
 7 | kca      | `kubectl --all-namespaces`                              | The kubectl command targeting all namespaces                                                     |
 8 | kaf      | `kubectl apply -f`                                      | Apply a YML file                                                                                 |
 9+| kapk     | `kubectl apply -k`                                      | Apply a kustomization directory                                                                  |
10 | keti     | `kubectl exec -ti`                                      | Drop into an interactive terminal on a container                                                 |
11 |          |                                                         | **Manage configuration quickly to switch contexts between local, dev and staging**               |
12 | kcuc     | `kubectl config use-context`                            | Set the current-context in a kubeconfig file                                                     |
13@@ -26,6 +27,7 @@ plugins=(... kubectl)
14 |          |                                                         | **General aliases**                                                                              |
15 | kdel     | `kubectl delete`                                        | Delete resources by filenames, stdin, resources and names, or by resources and label selector    |
16 | kdelf    | `kubectl delete -f`                                     | Delete a pod using the type and name specified in -f argument                                    |
17+| kdelk    | `kubectl delete -k`                                     | Delete all resources defined in a kustomization directory                                        |
18 | kge      | `kubectl get events --sort-by=".lastTimestamp"`         | Get events (sorted by timestamp)                                                                 |
19 | kgew     | `kubectl get events --watch --sort-by=".lastTimestamp"` | Get events and watch as they occur (sorted by timestamp)                                         |
20 |          |                                                         | **Pod management**                                                                               |
21diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
22index 1792d5967bf8be673587f0f8c830fff232fed0bd..1e608045454a2af5b54d2859ef2d7afd875fd0a4 100644
23--- a/plugins/kubectl/kubectl.plugin.zsh
24+++ b/plugins/kubectl/kubectl.plugin.zsh
25@@ -21,6 +21,9 @@ alias kca='_kca(){ kubectl "$@" --all-namespaces;  unset -f _kca; }; _kca'
26 # Apply a YML file
27 alias kaf='kubectl apply -f'
28 
29+# Apply a kustomization directory
30+alias kapk='kubectl apply -k'
31+
32 # Drop into an interactive terminal on a container
33 alias keti='kubectl exec -t -i'
34 
35@@ -36,6 +39,7 @@ alias kcgc='kubectl config get-contexts'
36 # General aliases
37 alias kdel='kubectl delete'
38 alias kdelf='kubectl delete -f'
39+alias kdelk='kubectl delete -k'
40 alias kge='kubectl get events --sort-by=".lastTimestamp"'
41 alias kgew='kubectl get events --sort-by=".lastTimestamp" --watch'
42