Skip to content

Commit

Permalink
chore: aws-eks: pre-destroy script should use region when getting clu…
Browse files Browse the repository at this point in the history
…ster details (#153)
  • Loading branch information
fidiego authored Dec 10, 2024
1 parent 4f834e9 commit 39de3ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aws-eks/pre-destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ set -o pipefail
set -e

echo "[pre-destroy] preparing to execute pre-destroy script"
aws sts get-caller-identity
role=aws sts get-caller-identity | jq '.Arn'

echo "[pre-destroy] running as role: "$role

echo "[pre-destroy] getting cluster credentials with aws eks update-kubeconfig"
aws eks update-kubeconfig --name $NUON_INSTALL_ID --alias $NUON_INSTALL_ID || echo "[pre-destroy] unable to get k8s credentials - exiting gracefully" exit 0
aws eks update-kubeconfig --region $AWS_REGION --name $NUON_INSTALL_ID --alias $NUON_INSTALL_ID || echo "[pre-destroy] unable to get k8s credentials - exiting gracefully" && exit 0

echo "[pre-destroy] deleting install namespace"
kubectl delete namespace $NUON_INSTALL_ID --ignore-not-found=true

0 comments on commit 39de3ad

Please sign in to comment.