forked from doitintl/kubeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
29 lines (26 loc) · 1.43 KB
/
test.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
29
#!/usr/bin/env bash
if [ -z "$REGION" ]; then
echo REGION not defined!
exit
fi
if [ -z "$CLUSTER" ]; then
echo CLUSTER not defined!
exit
fi
NODES=`gcloud container node-pools describe default-pool --cluster $CLUSTER|grep initialNodeCount|awk '{print $2}'`
NEW_NODES=$(($NODES + 1))
gcloud compute addresses create kubeip-test-1 --region $REGION
gcloud beta compute addresses update kubeip-test-1 --update-labels kubeip=reserved --region us-central1
IP1=`gcloud compute addresses describe kubeip-test-1 --region $REGION|grep address:|awk '{print $2}'`
gcloud compute addresses create kubeip-test-2 --region $REGION
gcloud beta compute addresses update kubeip-test-2 --update-labels kubeip=reserved --region us-central1
IP2=`gcloud compute addresses describe kubeip-test-2 --region $REGION|grep address:|awk '{print $2}'`
gcloud beta container clusters resize $CLUSTER --node-pool default-pool --size $NEW_NODES --quiet
STATUS1=`gcloud compute addresses describe kubeip-test-1 --region $REGION|grep status|awk '{print $2}'`
STATUS2=`gcloud compute addresses describe kubeip-test-2 --region $REGION|grep status|awk '{print $2}'`
echo 'expecting one IP IN_USE and one RESERVED'
echo 'Results:'
echo $STATUS1 '--' $STATUS2
gcloud beta container clusters resize $CLUSTER --node-pool default-pool --size $NODES --quiet
gcloud compute addresses delete kubeip-test-1 --region $REGION --quiet
gcloud compute addresses delete kubeip-test-2 --region $REGION --quiet