From aee439343eec82608a84776cdf8d384d86d0ced0 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sun, 8 Jun 2025 12:22:40 +0200 Subject: [PATCH] config/k9s: stackspin config --- .config/k9s/aliases.yaml | 9 ++++ .config/k9s/config.yaml | 41 +++++++++++++++++ .config/k9s/config.yml | 56 +++++++++++++++++++++++ .config/k9s/plugin.yml | 99 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 205 insertions(+) create mode 100644 .config/k9s/aliases.yaml create mode 100644 .config/k9s/config.yaml create mode 100644 .config/k9s/config.yml create mode 100755 .config/k9s/plugin.yml diff --git a/.config/k9s/aliases.yaml b/.config/k9s/aliases.yaml new file mode 100644 index 0000000..ee4d9ec --- /dev/null +++ b/.config/k9s/aliases.yaml @@ -0,0 +1,9 @@ +aliases: + dp: deployments + sec: v1/secrets + jo: jobs + cr: clusterroles + crb: clusterrolebindings + ro: roles + rb: rolebindings + np: networkpolicies diff --git a/.config/k9s/config.yaml b/.config/k9s/config.yaml new file mode 100644 index 0000000..e41d647 --- /dev/null +++ b/.config/k9s/config.yaml @@ -0,0 +1,41 @@ +k9s: + liveViewAutoRefresh: false + screenDumpDir: /home/janek/.local/state/k9s/screen-dumps + refreshRate: 2 + maxConnRetry: 5 + readOnly: false + noExitOnCtrlC: false + ui: + enableMouse: false + headless: false + logoless: false + crumbsless: false + reactive: false + noIcons: false + skipLatestRevCheck: false + disablePodCounting: false + shellPod: + image: busybox:1.35.0 + namespace: default + limits: + cpu: 100m + memory: 100Mi + imageScans: + enable: false + exclusions: + namespaces: [] + labels: {} + logger: + tail: 100 + buffer: 5000 + sinceSeconds: -1 + fullScreen: false + textWrap: false + showTime: false + thresholds: + cpu: + critical: 90 + warn: 70 + memory: + critical: 90 + warn: 70 diff --git a/.config/k9s/config.yml b/.config/k9s/config.yml new file mode 100644 index 0000000..b717721 --- /dev/null +++ b/.config/k9s/config.yml @@ -0,0 +1,56 @@ +k9s: + liveViewAutoRefresh: false + refreshRate: 2 + maxConnRetry: 5 + enableMouse: false + enableImageScan: false + headless: false + logoless: false + crumbsless: false + readOnly: false + noExitOnCtrlC: false + noIcons: false + shellPod: + image: busybox:1.35.0 + namespace: default + limits: + cpu: 100m + memory: 100Mi + skipLatestRevCheck: false + logger: + tail: 100 + buffer: 5000 + sinceSeconds: 300 + fullScreenLogs: false + textWrap: false + showTime: false + currentContext: ftt.gmbh + currentCluster: ftt.gmbh + keepMissingClusters: false + clusters: + ftt.gmbh: + namespace: + active: all + lockFavorites: false + favorites: + - stackspin + - stackspin-apps + - flux-system + - velero + - stackspout + - all + - default + view: + active: pod + featureGates: + nodeShell: false + portForwardAddress: localhost + thresholds: + cpu: + critical: 90 + warn: 70 + memory: + critical: 90 + warn: 70 + screenDumpDir: /tmp/k9s-screens-janek + disablePodCounting: false diff --git a/.config/k9s/plugin.yml b/.config/k9s/plugin.yml new file mode 100755 index 0000000..766237b --- /dev/null +++ b/.config/k9s/plugin.yml @@ -0,0 +1,99 @@ +# https://github.com/derailed/k9s/blob/master/plugins/flux.yaml +# move selected line to chosen resource in K9s, then: +# Shift-T (with confirmation) to toggle helm releases or kustomizations suspend and resume +# Shift-R (no confirmation) to reconcile a git source or a helm release or a kustomization +plugin: + + toggle-helmrelease: + shortCut: Shift-T + confirm: true + scopes: + - helmreleases + description: Toggle to suspend or resume a HelmRelease + command: sh + background: true + args: + - -c + - "flux $([ $(kubectl get helmreleases -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = \"true\" ] && echo \"resume\" || echo \"suspend\") helmrelease -n $NAMESPACE $NAME | less" + + toggle-kustomization: + shortCut: Shift-T + confirm: true + scopes: + - kustomizations + description: Toggle to suspend or resume a Kustomization + command: sh + background: true + args: + - -c + - "flux $([ $(kubectl get kustomizations -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = \"true\" ] && echo \"resume\" || echo \"suspend\") kustomization -n $NAMESPACE $NAME | less" + + reconcile-git: + shortCut: Shift-R + confirm: false + description: Flux reconcile + scopes: + - gitrepositories + command: sh + # background: false + background: true + args: + - -c + - "flux reconcile source git -n $NAMESPACE $NAME | less" + + reconcile-hr: + shortCut: Shift-R + confirm: false + description: Flux reconcile + scopes: + - helmreleases + command: sh + # background: false + background: true + args: + - -c + - "flux reconcile helmrelease -n $NAMESPACE $NAME | less" + + reconcile-ks: + shortCut: Shift-R + confirm: false + description: Flux reconcile + scopes: + - kustomizations + command: sh + # background: false + background: true + args: + - -c + - "flux reconcile kustomization -n $NAMESPACE $NAME | less" + + getall-ns: + shortCut: Shift-G + confirm: false + description: Get All Resources in NS + scopes: + - namespaces + command: sh + background: false + args: + - -c + - "kubectl get all -n $NAME | less" + + # https://github.com/derailed/k9s/issues/1017#issuecomment-769005253 + # requires https://github.com/rajatjindal/kubectl-modify-secret installed + # i.e. by krew install modify-secret + edit-secret: + shortCut: Ctrl-X + confirm: false + description: "Edit Decoded Secret" + scopes: + - secrets + command: kubectl + background: false + args: + - modify-secret + - --namespace + - $NAMESPACE + - --context + - $CONTEXT + - $NAME