From 86c0a53f59704d94604ef97ca9b5af3b20ecddb2 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Thu, 6 Jun 2024 09:22:55 +0200 Subject: [PATCH] add GKE destroyer script (#1307) --- scripts/orphan-clusters/gke-destroyer.sh | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 scripts/orphan-clusters/gke-destroyer.sh diff --git a/scripts/orphan-clusters/gke-destroyer.sh b/scripts/orphan-clusters/gke-destroyer.sh new file mode 100644 index 000000000..d47f03e0a --- /dev/null +++ b/scripts/orphan-clusters/gke-destroyer.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -euo pipefail + +if [[ "$#" -lt "2" ]]; then + >&2 echo "Usage: gke-destroyer.sh " + exit 6 +fi + +PREFIX="${1}" +WORKFLOW_NAME="${2}" +CLUSTER_NAME="$(kubectl get workflow "${WORKFLOW_NAME}" -o yaml | yq '.metadata.labels["infra.stackrox.com/cluster-id"]')" + +TIMESTAMP=$(date +%s) +RUNNER_NAME="${PREFIX}-${CLUSTER_NAME}-destroyer-${TIMESTAMP}" +AUTOMATION_FLAVORS_TAG=$(yq '.annotations.automationFlavorsVersion' chart/infra-server/Chart.yaml) + +manifest=$(cat <