1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-25 23:30:08 +00:00

kubectl: add aliases for serviceaccount, daemonsets and cronjob (#9344)

This commit is contained in:
Wenli Wan 2020-10-21 22:09:54 +08:00 committed by GitHub
parent 3f42700c0d
commit bf5574fc93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 4 deletions

View file

@ -95,9 +95,9 @@ plugins=(... kubectl)
| kgpvc | `kubectl get pvc` | List all PVCs | | kgpvc | `kubectl get pvc` | List all PVCs |
| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes | | kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor | | kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
| kdpvc | `kubectl describe pvc` | Descirbe all pvcs | | kdpvc | `kubectl describe pvc` | Describe all pvcs |
| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments | | kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
| | | | | | | **StatefulSets management** |
| kgss | `kubectl get statefulset` | List the statefulsets in ps format | | kgss | `kubectl get statefulset` | List the statefulsets in ps format |
| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes | | kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information | | kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
@ -106,6 +106,21 @@ plugins=(... kubectl)
| kdelss | `kubectl delete statefulset` | Delete the statefulset | | kdelss | `kubectl delete statefulset` | Delete the statefulset |
| ksss | `kubectl scale statefulset` | Scale a statefulset | | ksss | `kubectl scale statefulset` | Scale a statefulset |
| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | | krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
| | | **Service Accounts management** |
| kgsa | `kubectl get sa` | List all service accounts |
| kdsa | `kubectl describe sa` | Describe a service account in details |
| kdelsa | `kubectl delete sa` | Delete the service account |
| | | **DaemonSet management** |
| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format |
| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes |
| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor |
| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail |
| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument |
| | | **CronJob management** |
| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format |
| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor |
| kdcj | `kubectl describe cronjob` | Describe a CronJob in details |
| kdelcj | `kubectl delete cronjob` | Delete the CronJob |
## Wrappers ## Wrappers

View file

@ -150,6 +150,24 @@ alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc' alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete pvc' alias kdelpvc='kubectl delete pvc'
# Service account management.
alias kgsa="kubectl get sa"
alias kdsa="kubectl describe sa"
alias kdelsa="kubectl delete sa"
# DaemonSet management.
alias kgds='kubectl get daemonset'
alias kgdsw='kgds --watch'
alias keds='kubectl edit daemonset'
alias kdds='kubectl describe daemonset'
alias kdelds='kubectl delete daemonset'
# CronJob management.
alias kgcj='kubectl get cronjob'
alias kecj='kubectl edit cronjob'
alias kdcj='kubectl describe cronjob'
alias kdelcj='kubectl delete cronjob'
# Only run if the user actually has kubectl installed # Only run if the user actually has kubectl installed
if (( ${+_comps[kubectl]} )); then if (( ${+_comps[kubectl]} )); then
kj() { kubectl "$@" -o json | jq; } kj() { kubectl "$@" -o json | jq; }