Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(misc plugins): split up multiline commands, use less -K everywhere #2348

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions plugins/carvel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugin:
background: false
args:
- -c
- "export FORCE_COLOR=1;kapp inspect -a $NAME.app --namespace $NAMESPACE --kubeconfig-context $CONTEXT --color --tty |& less -R"
- "export FORCE_COLOR=1;kapp inspect -a $NAME.app --namespace $NAMESPACE --kubeconfig-context $CONTEXT --color --tty | less -RK"
kctrl-app-status:
shortCut: Shift-Q
confirm: false
Expand All @@ -21,7 +21,7 @@ plugin:
background: false
args:
- -c
- "export FORCE_COLOR=1;kctrl app status -a $NAME --namespace $NAMESPACE --kubeconfig-context $CONTEXT --color --tty |& less -R"
- "export FORCE_COLOR=1;kctrl app status -a $NAME --namespace $NAMESPACE --kubeconfig-context $CONTEXT --color --tty | less -RK"
kctrl-app-pause:
shortCut: Shift-T
confirm: false
Expand All @@ -32,7 +32,7 @@ plugin:
background: false
args:
- -c
- "export FORCE_COLOR=1;kctrl app pause -a $NAME --namespace $NAMESPACE --kubeconfig-context $CONTEXT --yes --color --tty |& less -R"
- "export FORCE_COLOR=1;kctrl app pause -a $NAME --namespace $NAMESPACE --kubeconfig-context $CONTEXT --yes --color --tty | less -RK"
kctrl-app-kick:
shortCut: Shift-Z
confirm: false
Expand All @@ -43,5 +43,4 @@ plugin:
background: false
args:
- -c
- "export FORCE_COLOR=1;kctrl app kick -a $NAME --namespace $NAMESPACE --kubeconfig-context $CONTEXT --yes --color --tty |& less -R"

- "export FORCE_COLOR=1;kctrl app kick -a $NAME --namespace $NAMESPACE --kubeconfig-context $CONTEXT --yes --color --tty | less -RK"
10 changes: 9 additions & 1 deletion plugins/crossplane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ plugin:
background: false
args:
- -c
- "kubectl lineage -d 6 --exclude-types Event,ProviderConfigUsage.aws.upbound.io,ProviderConfigUsage.kubernetes.crossplane.io --show-group --context $CONTEXT $RESOURCE_NAME $NAME | less"
- >-
kubectl lineage
-d 6
--exclude-types Event,ProviderConfigUsage.aws.upbound.io,ProviderConfigUsage.kubernetes.crossplane.io
--show-group
--context $CONTEXT
$RESOURCE_NAME
$NAME
| less -K
134 changes: 112 additions & 22 deletions plugins/flux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ plugin:
background: false
args:
- -c
- "flux --context $CONTEXT $([ $(kubectl --context $CONTEXT get helmreleases -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = \"true\" ] && echo \"resume\" || echo \"suspend\") helmrelease -n $NAMESPACE $NAME |& less"
- >-
suspended=$(kubectl --context $CONTEXT get helmreleases -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1);
verb=$([ $suspended = "true" ] && echo "resume" || echo "suspend");
flux
$verb helmrelease
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
toggle-kustomization:
shortCut: Shift-T
confirm: true
Expand All @@ -24,29 +31,46 @@ plugin:
background: false
args:
- -c
- "flux --context $CONTEXT $([ $(kubectl --context $CONTEXT get kustomizations -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = \"true\" ] && echo \"resume\" || echo \"suspend\") kustomization -n $NAMESPACE $NAME |& less"
- >-
suspended=$(kubectl --context $CONTEXT get kustomizations -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1);
verb=$([ $suspended = "true" ] && echo "resume" || echo "suspend");
flux
$verb kustomization
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-git:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- gitrepositories
- gitrepositories
command: bash
background: false
args:
- -c
- "flux --context $CONTEXT reconcile source git -n $NAMESPACE $NAME |& less"
- -c
- >-
flux
reconcile source git
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-hr:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- helmreleases
- helmreleases
command: bash
background: false
args:
- -c
- "flux --context $CONTEXT reconcile helmrelease -n $NAMESPACE $NAME |& less"
- -c
- >-
flux
reconcile helmrelease
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-helm-repo:
shortCut: Shift-Z
description: Flux reconcile
Expand All @@ -57,7 +81,12 @@ plugin:
confirm: false
args:
- -c
- "flux reconcile source helm --context $CONTEXT -n $NAMESPACE $NAME |& less"
- >-
flux
reconcile source helm
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-oci-repo:
shortCut: Shift-Z
description: Flux reconcile
Expand All @@ -68,48 +97,109 @@ plugin:
confirm: false
args:
- -c
- "flux reconcile source oci --context $CONTEXT -n $NAMESPACE $NAME |& less"
- >-
flux
reconcile source oci
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-ks:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- kustomizations
- kustomizations
command: bash
background: false
args:
- -c
- "flux --context $CONTEXT reconcile kustomization -n $NAMESPACE $NAME |& less"
- -c
- >-
flux
reconcile kustomization
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-ir:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- imagerepositories
- imagerepositories
command: sh
background: false
args:
- -c
- "flux --context $CONTEXT reconcile image repository -n $NAMESPACE $NAME | less"
- -c
- >-
flux
reconcile image repository
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-iua:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- imageupdateautomations
- imageupdateautomations
command: sh
background: false
args:
- -c
- "flux --context $CONTEXT reconcile image update -n $NAMESPACE $NAME | less"
- -c
- >-
flux
reconcile image update
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
trace:
shortCut: Shift-A
confirm: false
description: Flux trace
scopes:
- all
- all
command: bash
background: false
args:
- -c
- "flux --context $CONTEXT trace --kind `echo $RESOURCE_NAME | sed -E 's/ies$/y/' | sed -E 's/ses$/se/' | sed -E 's/(s|es)$//g'` --api-version $RESOURCE_GROUP/$RESOURCE_VERSION --namespace $NAMESPACE $NAME |& less"
- -c
- >-
resource=$(echo $RESOURCE_NAME | sed -E 's/ies$/y/' | sed -E 's/ses$/se/' | sed -E 's/(s|es)$//g')
flux
trace
--context $CONTEXT
--kind $resource
--api-version $RESOURCE_GROUP/$RESOURCE_VERSION
--namespace $NAMESPACE $NAME
| less -K
# credits: https://github.com/fluxcd/flux2/discussions/2494
get-suspended-helmreleases:
shortCut: Shift-S
confirm: false
description: Suspended Helm Releases
scopes:
- helmrelease
command: sh
background: false
args:
- -c
- >-
kubectl get
--all-namespaces
helmreleases.helm.toolkit.fluxcd.io -o json
| jq -r '.items[] | select(.spec.suspend==true) | [.metadata.namespace,.metadata.name,.spec.suspend] | @tsv'
| less
get-suspended-kustomizations:
shortCut: Shift-S
confirm: false
description: Suspended Kustomizations
scopes:
- kustomizations
command: sh
background: false
args:
- -c
- >-
kubectl get
--all-namespaces
kustomizations.kustomize.toolkit.fluxcd.io -o json
| jq -r '.items[] | select(.spec.suspend==true) | [.metadata.name,.spec.suspend] | @tsv'
| less
12 changes: 6 additions & 6 deletions plugins/get-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ plugin:
confirm: false
description: get-all
scopes:
- namespaces
- namespaces
command: sh
background: false
args:
- -c
- "kubectl get-all --context $CONTEXT -n $NAME | less"
- -c
- "kubectl get-all --context $CONTEXT -n $NAME | less -K"
get-all-other:
shortCut: g
confirm: false
description: get-all
scopes:
- all
- all
command: sh
background: false
args:
- -c
- "kubectl get-all --context $CONTEXT -n $NAMESPACE | less"
- -c
- "kubectl get-all --context $CONTEXT -n $NAMESPACE | less -K"
23 changes: 0 additions & 23 deletions plugins/get_suspended.yml

This file was deleted.

16 changes: 14 additions & 2 deletions plugins/helm-default-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,17 @@ plugin:
background: false
args:
- -c
- "kubectl get secrets --context $CONTEXT -n $NAMESPACE sh.helm.release.v1.$COL-NAME.v$(helm history -n $NAMESPACE --kube-context $CONTEXT $COL-NAME | grep deployed | cut -d$'\\t' -f1 | tr -d ' \\t') -o yaml | yq e '.data.release' - | base64 -d | base64 -d | gunzip | jq -r '.chart.values' | yq -P | less"

- >-
revision=$(helm history -n $NAMESPACE --kube-context $CONTEXT $COL-NAME | grep deployed | cut -d$'\t' -f1 | tr -d ' \t');
kubectl
get secrets
--context $CONTEXT
-n $NAMESPACE
sh.helm.release.v1.$COL-NAME.v$revision -o yaml
| yq e '.data.release' -
| base64 -d
| base64 -d
| gunzip
| jq -r '.chart.values'
| yq -P
| less -K
6 changes: 3 additions & 3 deletions plugins/helm_values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ plugin:
confirm: false
description: Values
scopes:
- helm
- helm
command: sh
background: false
args:
- -c
- "helm get values $COL-NAME -n $NAMESPACE --kube-context $CONTEXT | less"
- -c
- "helm get values $COL-NAME -n $NAMESPACE --kube-context $CONTEXT | less -K"