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 24, 2024
1 parent badd3a2 commit ca7f175
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,22 @@ get-credentials-ci:
--name "contrast-ci" \
--admin
get-credentials-tdxbm:
get-credentials-from-gcloud path:
#!/usr/bin/env bash
set -euo pipefail
tmpConfig=$(mktemp)
gcloud secrets versions access \
projects/796962942582/secrets/m50-ganondorf-kubeconf/versions/2 \
--out-file="$tmpConfig"
gcloud secrets versions access {{ path }} --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%%:*}
get-credentials-tdxbm: (get-credentials-from-gcloud "projects/796962942582/secrets/m50-ganondorf-kubeconf/versions/2")
get-credentials-snpbm: (get-credentials-from-gcloud "projects/796962942582/secrets/discovery-kubeconf/versions/1")
# Destroy a running AKS cluster.
destroy:
nix run .#scripts.destroy-coco-aks -- --name="$azure_resource_group"
Expand Down

0 comments on commit ca7f175

Please sign in to comment.