b04e01d41822963875db876e1d3e7e7d1b67541c

Author
Firas Bouzguenda <19820205+mofibo@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(kubectl): add aliases for `kubectl rollout restart` (#12883)

Co-authored-by: Marc Cornellà <marc@mcornella.com>

Diff

 1diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
 2index 6f347a8ee940656e790d7fdc0193453e8200d6c6..e510c5f406d7733a0b8711324cadd839a884d68f 100644
 3--- a/plugins/kubectl/README.md
 4+++ b/plugins/kubectl/README.md
 5@@ -27,7 +27,7 @@ plugins=(... kubectl)
 6 | kdel     | `kubectl delete`                                        | Delete resources by filenames, stdin, resources and names, or by resources and label selector    |
 7 | kdelf    | `kubectl delete -f`                                     | Delete a pod using the type and name specified in -f argument                                    |
 8 | kge      | `kubectl get events --sort-by=".lastTimestamp"`         | Get events (sorted by timestamp)                                                                 |
 9-| kgew     | `kubectl get events --watch --sort-by=".lastTimestamp"` | Get events and watch as they occur (sorted by timestamp)                                                                 |
10+| kgew     | `kubectl get events --watch --sort-by=".lastTimestamp"` | Get events and watch as they occur (sorted by timestamp)                                         |
11 |          |                                                         | **Pod management**                                                                               |
12 | kgp      | `kubectl get pods`                                      | List all pods in ps output format                                                                |
13 | kgpl     | `kgp -l`                                                | Get pods by label. Example: `kgpl "app=myapp" -n myns`                                           |
14@@ -74,6 +74,7 @@ plugins=(... kubectl)
15 | kdeld    | `kubectl delete deployment`                             | Delete the deployment                                                                            |
16 | ksd      | `kubectl scale deployment`                              | Scale a deployment                                                                               |
17 | krsd     | `kubectl rollout status deployment`                     | Check the rollout status of a deployment                                                         |
18+| krrd     | `kubectl rollout restart deployment`                    | Rollout restart a deployment                                                                     |
19 | kres     | `kubectl set env $@ REFRESHED_AT=...`                   | Recreate all pods in deployment with zero-downtime                                               |
20 |          |                                                         | **Rollout management**                                                                           |
21 | kgrs     | `kubectl get replicaset`                                | List all ReplicaSets `rs` created by the deployment                                              |
22@@ -112,6 +113,7 @@ plugins=(... kubectl)
23 | kdelss   | `kubectl delete statefulset`                            | Delete the statefulset                                                                           |
24 | ksss     | `kubectl scale statefulset`                             | Scale a statefulset                                                                              |
25 | krsss    | `kubectl rollout status statefulset`                    | Check the rollout status of a deployment                                                         |
26+| krrss    | `kubectl rollout restart statefulset`                   | Rollout restart a statefulset                                                                    |
27 |          |                                                         | **Service Accounts management**                                                                  |
28 | kdsa     | `kubectl describe sa`                                   | Describe a service account in details                                                            |
29 | kdelsa   | `kubectl delete sa`                                     | Delete the service account                                                                       |
30diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
31index 4a72c02af98822055640ea05012147d948258936..912136da4e258d9fd6fad1b27375a5e1cc19f133 100644
32--- a/plugins/kubectl/kubectl.plugin.zsh
33+++ b/plugins/kubectl/kubectl.plugin.zsh
34@@ -98,6 +98,7 @@ alias kdd='kubectl describe deployment'
35 alias kdeld='kubectl delete deployment'
36 alias ksd='kubectl scale deployment'
37 alias krsd='kubectl rollout status deployment'
38+alias krrd='kubectl rollout restart deployment'
39 
40 function kres(){
41   kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S)
42@@ -120,6 +121,7 @@ alias kdss='kubectl describe statefulset'
43 alias kdelss='kubectl delete statefulset'
44 alias ksss='kubectl scale statefulset'
45 alias krsss='kubectl rollout status statefulset'
46+alias krrss='kubectl rollout restart statefulset'
47 
48 # Port forwarding
49 alias kpf="kubectl port-forward"