From 309465e2b6ea92af95d854b859e23678e956f4f6 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 24 Jan 2022 19:07:12 -0500 Subject: [PATCH] Fix the flux plugin to use the context of the currently running instance (#1366) Rather than the default context. This means if you run k9s --context XXX, any flux commands run by the plugin will run on the correct context --- plugins/{flux.yaml => flux.yml} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename plugins/{flux.yaml => flux.yml} (60%) diff --git a/plugins/flux.yaml b/plugins/flux.yml similarity index 60% rename from plugins/flux.yaml rename to plugins/flux.yml index e52d2f8e..85f18994 100644 --- a/plugins/flux.yaml +++ b/plugins/flux.yml @@ -13,7 +13,7 @@ plugin: background: false 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" + - "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" toggle-kustomization: shortCut: Shift-T confirm: true @@ -24,7 +24,7 @@ plugin: background: false 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" + - "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" reconcile-git: shortCut: Shift-R confirm: false @@ -35,7 +35,7 @@ plugin: background: false args: - -c - - "flux reconcile source git -n $NAMESPACE $NAME | less" + - "flux --context $CONTEXT reconcile source git -n $NAMESPACE $NAME | less" reconcile-hr: shortCut: Shift-R confirm: false @@ -46,7 +46,7 @@ plugin: background: false args: - -c - - "flux reconcile helmrelease -n $NAMESPACE $NAME | less" + - "flux --context $CONTEXT reconcile helmrelease -n $NAMESPACE $NAME | less" reconcile-ks: shortCut: Shift-R confirm: false @@ -57,7 +57,7 @@ plugin: background: false args: - -c - - "flux reconcile kustomization -n $NAMESPACE $NAME | less" + - "flux --context $CONTEXT reconcile kustomization -n $NAMESPACE $NAME | less" trace: shortCut: Shift-A confirm: false @@ -68,4 +68,4 @@ plugin: background: false args: - -c - - "flux trace $NAME --kind `echo $RESOURCE_NAME | sed -E 's/(s|es)$//g'` --api-version $RESOURCE_GROUP/$RESOURCE_VERSION --namespace $NAMESPACE $NAME | less" + - "flux --context $CONTEXT trace $NAME --kind `echo $RESOURCE_NAME | sed -E 's/(s|es)$//g'` --api-version $RESOURCE_GROUP/$RESOURCE_VERSION --namespace $NAMESPACE $NAME | less"