Skip to content
Snippets Groups Projects
Commit fd540aa0 authored by Dmytro Bogatov's avatar Dmytro Bogatov :two_hearts:
Browse files

Upgrade cluster.

parent cf642886
No related branches found
No related tags found
No related merge requests found
Pipeline #48917 passed
...@@ -19,6 +19,28 @@ usage () { ...@@ -19,6 +19,28 @@ usage () {
exit 1; exit 1;
} }
get_gcp_k8s_version () {
local REGEX='[0-9]\.([0-9]+).*'
VERSION=$1
gcloud container get-server-config --zone=us-central1-f --format=json \
| jq -r '.channels[1].validVersions[]' \
| while read version
do
if [[ $version =~ $REGEX ]]
then
major=${BASH_REMATCH[1]}
if [[ $major == $VERSION ]]
then
echo "$version"
fi
else
echo "Match failed for: $version"
exit 1
fi
done
}
if ! [ $# -eq 2 ] if ! [ $# -eq 2 ]
then then
usage usage
...@@ -34,7 +56,7 @@ PROJECT=$2 ...@@ -34,7 +56,7 @@ PROJECT=$2
STATUSSITECONFIG=$CERTDIRPATH/appsettings.production.yml STATUSSITECONFIG=$CERTDIRPATH/appsettings.production.yml
TIMESTAMP=$(date +%s) TIMESTAMP=$(date +%s)
VERSION="1.23.8-gke.1900" VERSION="23"
APIKEY=$(cat $STATUSSITECONFIG | grep "ApiKey:" | cut -d'"' -f 2) APIKEY=$(cat $STATUSSITECONFIG | grep "ApiKey:" | cut -d'"' -f 2)
SERVICEACC="admin-acc-$TIMESTAMP" SERVICEACC="admin-acc-$TIMESTAMP"
...@@ -47,12 +69,15 @@ docker login -u $EMAIL -p "$DOCKERPASS" registry.dbogatov.org ...@@ -47,12 +69,15 @@ docker login -u $EMAIL -p "$DOCKERPASS" registry.dbogatov.org
# PROVISION # PROVISION
k8s_version=$(get_gcp_k8s_version $VERSION)
echo "Will deploy K8S $k8s_version"
gcloud services enable container.googleapis.com --project "$PROJECT" gcloud services enable container.googleapis.com --project "$PROJECT"
gcloud beta container --project "$PROJECT" clusters create "websites-$TIMESTAMP" \ gcloud beta container --project "$PROJECT" clusters create "websites-$TIMESTAMP" \
--zone "us-central1-a" \ --zone "us-central1-a" \
--no-enable-basic-auth \ --no-enable-basic-auth \
--cluster-version "$VERSION" \ --cluster-version "$k8s_version" \
--release-channel "None" \ --release-channel "None" \
--machine-type "n1-standard-1" \ --machine-type "n1-standard-1" \
--image-type "COS_CONTAINERD" \ --image-type "COS_CONTAINERD" \
......
...@@ -7,7 +7,7 @@ set -e ...@@ -7,7 +7,7 @@ set -e
source sources/data.sh source sources/data.sh
source .secret.sh source .secret.sh
VALUES=( "34.28.237.78" ) VALUES=( "104.198.35.72" )
echo "Values are ${VALUES[*]}" echo "Values are ${VALUES[*]}"
# #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment