From afd5b9f38c1e631c2dc2e4933dfa28cf45229a43 Mon Sep 17 00:00:00 2001
From: Dmytro Bogatov <dmytro@dbogatov.org>
Date: Thu, 3 Aug 2023 12:39:12 -0400
Subject: [PATCH] Upgrade cluster.
---
infra/script.sh | 13 ++++++++-----
infra/set-dns.sh | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/infra/script.sh b/infra/script.sh
index 7e03594..28dfffa 100755
--- a/infra/script.sh
+++ b/infra/script.sh
@@ -23,7 +23,7 @@ get_gcp_k8s_version () {
local REGEX='[0-9]\.([0-9]+).*'
VERSION=$1
- gcloud container get-server-config --zone=us-central1-f --format=json \
+ gcloud container get-server-config --zone=$REGION-$ZONE --format=json \
| jq -r '.channels[1].validVersions[]' \
| while read version
do
@@ -55,8 +55,11 @@ CERTDIRPATH=$1
PROJECT=$2
STATUSSITECONFIG=$CERTDIRPATH/appsettings.production.yml
-TIMESTAMP=$(date +%s)
+# TIMESTAMP=$(date +%s)
+TIMESTAMP="1691077967"
VERSION="23"
+REGION="us-east1"
+ZONE="b"
APIKEY=$(cat $STATUSSITECONFIG | grep "ApiKey:" | cut -d'"' -f 2)
SERVICEACC="admin-acc-$TIMESTAMP"
@@ -76,7 +79,7 @@ echo "Enabling K8S API, may take a while..."
gcloud services enable container.googleapis.com --project "$PROJECT"
gcloud beta container --project "$PROJECT" clusters create "websites-$TIMESTAMP" \
- --zone "us-central1-a" \
+ --zone $REGION-$ZONE \
--no-enable-basic-auth \
--cluster-version "$k8s_version" \
--release-channel "None" \
@@ -92,7 +95,7 @@ gcloud beta container --project "$PROJECT" clusters create "websites-$TIMESTAMP"
--monitoring=SYSTEM \
--enable-ip-alias \
--network "projects/$PROJECT/global/networks/default" \
- --subnetwork "projects/$PROJECT/regions/us-central1/subnetworks/default" \
+ --subnetwork "projects/$PROJECT/regions/$REGION/subnetworks/default" \
--no-enable-intra-node-visibility \
--addons HorizontalPodAutoscaling,HttpLoadBalancing,GcePersistentDiskCsiDriver \
--no-enable-autoupgrade \
@@ -100,7 +103,7 @@ gcloud beta container --project "$PROJECT" clusters create "websites-$TIMESTAMP"
# clear other clusters from config
rm ~/.kube/config
-gcloud container clusters get-credentials "websites-$TIMESTAMP" --zone us-central1-a --project "$PROJECT"
+gcloud container clusters get-credentials "websites-$TIMESTAMP" --zone $REGION-$ZONE --project "$PROJECT"
gcloud services enable cloudresourcemanager.googleapis.com --project "$PROJECT"
gcloud beta iam service-accounts create $SERVICEACC --project "$PROJECT"
diff --git a/infra/set-dns.sh b/infra/set-dns.sh
index 056106d..ac01a09 100755
--- a/infra/set-dns.sh
+++ b/infra/set-dns.sh
@@ -7,7 +7,7 @@ set -e
source sources/data.sh
source .secret.sh
-VALUES=( "34.30.186.254" )
+VALUES=( "34.138.245.221" )
echo "Values are ${VALUES[*]}"
#
--
GitLab