Skip to content

Commit

Permalink
just: add get-credentials-snpbm
Browse files Browse the repository at this point in the history
  • Loading branch information
Freax13 committed Jul 23, 2024
1 parent badd3a2 commit acc717a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit acc717a

Please sign in to comment.