Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(toil improvement): add script to find demo clusters for obscurely named VMs #1412

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions scripts/orphan-clusters/find-demo-clusters-for-vms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# This script finds infra cluster names for obscure VM prefixes from the Janitor control output
# gcloud compute instances list --project acs-team-temp-dev --format json | jq -r '.[].name' | sed 's/gke-//; s/-default-pool.*//; s/-master.*//; s/-worker.*//' | sort | uniq

set -euo pipefail

if [[ "$#" -lt "1" ]]; then
>&2 echo "Usage: find-demo-clusters-for-vms.sh <VM prefix>"
exit 6
fi

CLUSTER="$1"
INSTANCE=$(gcloud compute instances list --project acs-team-temp-dev --format json \
| jq -r '.[].name' \
| grep "^gke-${CLUSTER}.*" \
| head -n 1)

gcloud compute instances describe "${INSTANCE}" --project acs-team-temp-dev --format json | jq -r '.labels.name'
Loading