Skip to content

Commit

Permalink
Fix gke zone in release cluster script
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Kwiek <maciej@isovalent.com>
  • Loading branch information
nebril committed Feb 10, 2020
1 parent ce25d21 commit 5bd5676
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions jenkinsfiles/ginkgo-gke.Jenkinsfile
Expand Up @@ -11,6 +11,7 @@ pipeline {
TESTDIR="${WORKSPACE}/${PROJ_PATH}/test"
GOPATH="${WORKSPACE}"
GKE_KEY=credentials('gke-key')
GKE_ZONE="us-west1-a"
}

options {
Expand Down
5 changes: 1 addition & 4 deletions test/gke/get-cluster-version.sh
Expand Up @@ -6,9 +6,6 @@

set -e

zone=europe-west4-a


CLUSTER_NAME=$(cat ./gke/cluster-name)
K8S_VERSION=$(gcloud container clusters list --filter "name:${CLUSTER_NAME}" | awk '{print $3}' | grep -v MASTER_VERSION | sed -E 's/([0-9]+\.[0-9]+)\..*/\1/')
K8S_VERSION=$(gcloud container clusters list --zone $GKE_ZONE --filter "name:${CLUSTER_NAME}" | awk '{print $3}' | grep -v MASTER_VERSION | sed -E 's/([0-9]+\.[0-9]+)\..*/\1/')
echo ${K8S_VERSION}
3 changes: 1 addition & 2 deletions test/gke/release-cluster.sh
Expand Up @@ -2,12 +2,11 @@

set -e

zone=europe-west4-a
export KUBECONFIG=gke-kubeconfig

cluster=$(cat cluster-name)
echo "scaling $cluster ng to 0"
yes | gcloud container clusters resize $cluster --node-pool default-pool --num-nodes 0 --zone $zone
yes | gcloud container clusters resize $cluster --node-pool default-pool --num-nodes 0 --zone $GKE_ZONE

echo "releasing cluster lock from $cluster"
kubectl annotate deployment lock lock-
Expand Down
7 changes: 3 additions & 4 deletions test/gke/select-cluster.sh
Expand Up @@ -4,16 +4,15 @@ set -e

locked=1

zone=us-west1-a
export KUBECONFIG=gke-kubeconfig

while [ $locked -ne 0 ]; do
rm gke-kubeconfig || true
echo "selecting random cluster"
cluster=$(gcloud container clusters list --zone $zone | grep cilium-ci | sort -R | head -n 1 | awk '{print $1}')
cluster=$(gcloud container clusters list --zone $GKE_ZONE | grep cilium-ci | sort -R | head -n 1 | awk '{print $1}')

echo "getting kubeconfig for $cluster"
gcloud container clusters get-credentials --zone $zone $cluster
gcloud container clusters get-credentials --zone $GKE_ZONE $cluster

echo "aquiring cluster lock"
set +e
Expand All @@ -33,7 +32,7 @@ echo "creating cilium ns"
kubectl create ns cilium || true

echo "scaling $cluster to 2"
yes | gcloud container clusters resize $cluster --node-pool default-pool --num-nodes 2 --zone $zone
yes | gcloud container clusters resize $cluster --node-pool default-pool --num-nodes 2 --zone $GKE_ZONE

echo "labeling nodes"
index=1
Expand Down

0 comments on commit 5bd5676

Please sign in to comment.