k9s: plugins
This commit is contained in:
parent
e5f9508eb9
commit
049c4e8304
1 changed files with 119 additions and 0 deletions
119
dot_config/k9s/plugins.yaml
Normal file
119
dot_config/k9s/plugins.yaml
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
plugins:
|
||||||
|
reconcile-flux:
|
||||||
|
scopes: &flux_scopes
|
||||||
|
- kustomizations
|
||||||
|
- helmreleases
|
||||||
|
- gitrepositories
|
||||||
|
- ocirepositories
|
||||||
|
- helmrepositories
|
||||||
|
- imagerepositories
|
||||||
|
- imageupdateautomations
|
||||||
|
shortCut: f
|
||||||
|
background: true
|
||||||
|
description: Reconcile flux resource
|
||||||
|
command: bash
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- >
|
||||||
|
kubectl annotate
|
||||||
|
--overwrite
|
||||||
|
--context "$CONTEXT"
|
||||||
|
--namespace "$NAMESPACE"
|
||||||
|
${RESOURCE_NAME}.${RESOURCE_GROUP}
|
||||||
|
$NAME
|
||||||
|
reconcile.fluxcd.io/requestedAt=$(date -Iseconds)
|
||||||
|
&& echo "Reconiliation requested"
|
||||||
|
toggle-flux:
|
||||||
|
scopes: *flux_scopes
|
||||||
|
shortCut: s
|
||||||
|
background: true
|
||||||
|
description: Toggle flux
|
||||||
|
command: bash
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
ku() {
|
||||||
|
local verb="$1"
|
||||||
|
shift
|
||||||
|
kubectl --context dkube --namespace flux-system $verb ${RESOURCE_NAME}.${RESOURCE_GROUP} $NAME "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
S="$(ku get -o jsonpath='{.spec.suspend }')";
|
||||||
|
|
||||||
|
if [[ "$S" == true ]] ; then
|
||||||
|
ku patch --type=json -p '[{ "op": "remove", "path": "/spec/suspend"}]';
|
||||||
|
echo "$RESOURCE_NAME resumed"
|
||||||
|
else
|
||||||
|
ku patch --type=json -p '[{ "op": "replace", "path": "/spec/suspend", "value": true}]';
|
||||||
|
echo "$RESOURCE_NAME suspended"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
trace:
|
||||||
|
shortCut: Ctrl-T
|
||||||
|
confirm: false
|
||||||
|
description: Flux trace
|
||||||
|
scopes:
|
||||||
|
- all
|
||||||
|
command: bash
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -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
|
||||||
|
get-suspended-helmreleases:
|
||||||
|
shortCut: Shift-S
|
||||||
|
confirm: false
|
||||||
|
description: Suspended Helm Releases
|
||||||
|
scopes:
|
||||||
|
- helmrelease
|
||||||
|
command: sh
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- kubectl get --context $CONTEXT --all-namespaces helmreleases.helm.toolkit.fluxcd.io
|
||||||
|
-o json | jq -r '.items[] | select(.spec.suspend==true) | [.metadata.namespace,.metadata.name,.spec.suspend]
|
||||||
|
| @tsv' | less -K
|
||||||
|
get-suspended-kustomizations:
|
||||||
|
shortCut: Shift-S
|
||||||
|
confirm: false
|
||||||
|
description: Suspended Kustomizations
|
||||||
|
scopes:
|
||||||
|
- kustomizations
|
||||||
|
command: sh
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- kubectl get --context $CONTEXT --all-namespaces kustomizations.kustomize.toolkit.fluxcd.io
|
||||||
|
-o json | jq -r '.items[] | select(.spec.suspend==true) | [.metadata.name,.spec.suspend]
|
||||||
|
| @tsv' | less -K
|
||||||
|
stern:
|
||||||
|
shortCut: Ctrl-L
|
||||||
|
confirm: false
|
||||||
|
description: Logs <Stern>
|
||||||
|
scopes:
|
||||||
|
- pods
|
||||||
|
command: stern
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- --tail
|
||||||
|
- 50
|
||||||
|
- $FILTER
|
||||||
|
- -n
|
||||||
|
- $NAMESPACE
|
||||||
|
- --context
|
||||||
|
- $CONTEXT
|
||||||
|
node-shell:
|
||||||
|
shortCut: s
|
||||||
|
confirm: false
|
||||||
|
description: Node Shell
|
||||||
|
scopes:
|
||||||
|
- nodes
|
||||||
|
command: kubectl
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- node-shell
|
||||||
|
- --context
|
||||||
|
- $CONTEXT
|
||||||
|
- $NAME
|
Loading…
Add table
Reference in a new issue