From acc717a7cb862418f1905ec210a11907d4ea4599 Mon Sep 17 00:00:00 2001 From: Tom Dohrmann Date: Tue, 23 Jul 2024 10:11:15 +0200 Subject: [PATCH] just: add get-credentials-snpbm --- justfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/justfile b/justfile index 10753839a5..0664c8e6fd 100644 --- a/justfile +++ b/justfile @@ -238,6 +238,20 @@ get-credentials-tdxbm: yq -i '.current-context = env(newContext)' $mergedConfig mv $mergedConfig ${KUBECONFIG_BAK%%:*} +get-credentials-snpbm: + #!/usr/bin/env bash + set -euo pipefail + tmpConfig=$(mktemp) + gcloud secrets versions access \ + projects/796962942582/secrets/discovery-kubeconf/versions/1 \ + --out-file="$tmpConfig" + mergedConfig=$(mktemp) + KUBECONFIG_BAK=${KUBECONFIG:-~/.kube/config} + KUBECONFIG=$tmpConfig:${KUBECONFIG_BAK} kubectl config view --flatten > $mergedConfig + export newContext=$(yq -r '.contexts.[0].name' $tmpConfig) + yq -i '.current-context = env(newContext)' $mergedConfig + mv $mergedConfig ${KUBECONFIG_BAK%%:*} + # Destroy a running AKS cluster. destroy: nix run .#scripts.destroy-coco-aks -- --name="$azure_resource_group"