summaryrefslogtreecommitdiff
path: root/plugins/kubectl
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2022-04-02 13:24:35 -0500
committerTuowen Zhao <ztuowen@gmail.com>2022-04-02 13:24:35 -0500
commit2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945 (patch)
tree99add95300f57806b89bd885a5f5322ce9f9ac1a /plugins/kubectl
parentcae9a2b797649379e865e6bd73bc67e294e4ac77 (diff)
parent53863e7b3ff0c2e2816e90dab3d870adebdf49c7 (diff)
downloadzsh-2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945.tar.gz
zsh-2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945.tar.bz2
zsh-2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/kubectl')
-rw-r--r--plugins/kubectl/README.md13
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh23
2 files changed, 21 insertions, 15 deletions
diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
index f6651c8cd..579a90b3b 100644
--- a/plugins/kubectl/README.md
+++ b/plugins/kubectl/README.md
@@ -22,7 +22,7 @@ plugins=(... kubectl)
| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
| kccc | `kubectl config current-context` | Display the current-context |
-| kcgc | `kubectl config get-contexts` | List of contexts available
+| kcgc | `kubectl config get-contexts` | List of contexts available |
| | | **General aliases** |
| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
@@ -71,9 +71,11 @@ plugins=(... kubectl)
| kdeld | `kubectl delete deployment` | Delete the deployment |
| ksd | `kubectl scale deployment` | Scale a deployment |
| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment |
-| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
+| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
| | | **Rollout management** |
-| kgrs | `kubectl get rs` | To see the ReplicaSet `rs` created by the deployment |
+| kgrs | `kubectl get replicaset` | List all ReplicaSets `rs` created by the deployment |
+| kdrs | `kubectl describe replicaset` | Describe ReplicaSet in detail |
+| kers | `kubectl edit replicaset` | Edit ReplicaSet from the default editor |
| krh | `kubectl rollout history` | Check the revisions of this deployment |
| kru | `kubectl rollout undo` | Rollback to the previous revision |
| | | **Port forwarding** |
@@ -120,6 +122,11 @@ plugins=(... kubectl)
| 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 |
+| | | **Job management** |
+| kgj | `kubectl get job` | List all Job in ps output format |
+| kej | `kubectl edit job` | Edit a Job in details |
+| kdj | `kubectl describe job` | Describe the Job |
+| kdelj | `kubectl delete job` | Delete the Job |
## Wrappers
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index eed5727d1..095d2b328 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -1,21 +1,12 @@
if (( $+commands[kubectl] )); then
- # TODO: 2022-01-05: remove this block
- # remove old generated files
- command rm -f "$ZSH_CACHE_DIR/kubectl_completion"
-
- # TODO: 2022-01-05: remove this bit of code as it exists in oh-my-zsh.sh
- # Add completions folder in $ZSH_CACHE_DIR
- command mkdir -p "$ZSH_CACHE_DIR/completions"
- (( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
-
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kubectl" ]]; then
- kubectl completion zsh >| "$ZSH_CACHE_DIR/completions/_kubectl"
+ kubectl completion zsh | tee "$ZSH_CACHE_DIR/completions/_kubectl" >/dev/null
source "$ZSH_CACHE_DIR/completions/_kubectl"
else
source "$ZSH_CACHE_DIR/completions/_kubectl"
- kubectl completion zsh >| "$ZSH_CACHE_DIR/completions/_kubectl" &|
+ kubectl completion zsh | tee "$ZSH_CACHE_DIR/completions/_kubectl" >/dev/null &|
fi
fi
@@ -112,7 +103,9 @@ function kres(){
}
# Rollout management.
-alias kgrs='kubectl get rs'
+alias kgrs='kubectl get replicaset'
+alias kdrs='kubectl describe replicaset'
+alias kers='kubectl edit replicaset'
alias krh='kubectl rollout history'
alias kru='kubectl rollout undo'
@@ -178,6 +171,12 @@ alias kecj='kubectl edit cronjob'
alias kdcj='kubectl describe cronjob'
alias kdelcj='kubectl delete cronjob'
+# Job management.
+alias kgj='kubectl get job'
+alias kej='kubectl edit job'
+alias kdj='kubectl describe job'
+alias kdelj='kubectl delete job'
+
# Only run if the user actually has kubectl installed
if (( ${+_comps[kubectl]} )); then
function kj() { kubectl "$@" -o json | jq; }