agones.dev/agones@v1.53.0/build/performance-test.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2023 Google LLC All Rights Reserved. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 set -e 17 CLUSTER_NAME=$1 18 CLUSTER_LOCATION=$2 19 REGISTRY=$3 20 PROJECT=$4 21 REPLICAS=$5 22 AUTO_SHUTDOWN_DELAY=$6 23 BUFFER_SIZE=$7 24 MAX_REPLICAS=$8 25 DURATION=$9 26 CLIENTS=${10} 27 INTERVAL=${11} 28 29 export SHELL="/bin/bash" 30 mkdir -p /go/src/agones.dev/ 31 ln -s /workspace /go/src/agones.dev/agones 32 cd /go/src/agones.dev/agones/build 33 34 gcloud config set project $PROJECT 35 gcloud container clusters get-credentials $CLUSTER_NAME \ 36 --zone=$CLUSTER_LOCATION --project=$PROJECT 37 38 make install LOG_LEVEL=info REGISTRY='"'$REGISTRY'"' DOCKER_RUN="" 39 40 cd /go/src/agones.dev/agones/test/load/allocation 41 42 # use the input values to populate the yaml files for fleet and autoscaler, and then apply them 43 cp performance-test-fleet-template.yaml performance-test-fleet.yaml 44 cp performance-test-autoscaler-template.yaml performance-test-autoscaler.yaml 45 cp performance-test-variable-template.txt performance-test-variable.txt 46 47 sed -i 's/REPLICAS_REPLACEMENT/'$REPLICAS'/g' performance-test-fleet.yaml 48 sed -i 's/AUTOMATIC_SHUTDOWN_DELAY_SEC_REPLACEMENT/'$AUTO_SHUTDOWN_DELAY'/g' performance-test-fleet.yaml 49 50 sed -i 's/BUFFER_SIZE_REPLACEMENT/'$BUFFER_SIZE'/g' performance-test-autoscaler.yaml 51 sed -i 's/MIN_REPLICAS_REPLACEMENT/'$REPLICAS'/g' performance-test-autoscaler.yaml 52 sed -i 's/MAX_REPLICAS_REPLACEMENT/'$MAX_REPLICAS'/g' performance-test-autoscaler.yaml 53 54 sed -i 's/DURATION_REPLACEMENT/'$DURATION'/g' performance-test-variable.txt 55 sed -i 's/CLIENTS_REPLACEMENT/'$CLIENTS'/g' performance-test-variable.txt 56 sed -i 's/INTERVAL_REPLACEMENT/'$INTERVAL'/g' performance-test-variable.txt 57 58 kubectl apply -f performance-test-fleet.yaml 59 kubectl apply -f performance-test-autoscaler.yaml 60 61 # wait for the fleet to be ready 62 while [ $(kubectl get -f performance-test-fleet.yaml -o=jsonpath='{.spec.replicas}') != $(kubectl get -f performance-test-fleet.yaml -o=jsonpath='{.status.readyReplicas}') ] 63 do 64 sleep 1 65 done 66 67 cat performance-test-fleet.yaml 68 cat performance-test-autoscaler.yaml 69 cat performance-test-variable.txt 70 71 printf "\nStart testing." 72 ./runScenario.sh performance-test-variable.txt 73 74 kubectl delete -f performance-test-fleet.yaml 75 kubectl delete -f performance-test-autoscaler.yaml 76 printf "\nFinish testing." 77 78 rm performance-test-fleet.yaml performance-test-autoscaler.yaml performance-test-variable.txt