-
Notifications
You must be signed in to change notification settings - Fork 5
/
teardown.sh
executable file
·28 lines (21 loc) · 1.05 KB
/
teardown.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
export PROJECT_ID=$(gcloud info --format='value(config.project)')
export CLUSTER_LOCATION=us-central1
export CLUSTER_NAME="redis-gke-cluster-$CLUSTER_LOCATION"
export ZONE=us-central1-a
export POSTGRESQL_INSTANCE=redis-postgresql-instance
export REDIS_CLOUD_BUILD_TRIGGER="redis-cb-trigger"
# remove Cloud Build trigger
gcloud alpha builds triggers delete $REDIS_CLOUD_BUILD_TRIGGER --region=$CLUSTER_LOCATION
# remove CLoudSQL PostgreSQL instance
echo "Y" | gcloud sql instances delete $POSTGRESQL_INSTANCE
# unregsiter Anthos fleet membership
gcloud container fleet memberships unregister $CLUSTER_NAME-membership \
--gke-cluster=${CLUSTER_LOCATION}/${CLUSTER_NAME}
# remove GKE cluster
echo "Y" | gcloud container clusters delete $CLUSTER_NAME --region=$CLUSTER_LOCATION
# remove two public reserved static IP addresses
echo "Y" | gcloud compute addresses delete redis-api-gateway-ip --region us-central1
echo "Y" | gcloud compute addresses delete redis-client-host-ip --region us-central1
# remove the GCP project
# gcloud projects delete $PROJECT_ID