agones.dev/agones@v1.54.0/test/load/allocation/runAllocation.sh (about)

     1  # Copyright 2020 Google LLC All Rights Reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  #!/bin/bash
    16  
    17  NAMESPACE=${NAMESPACE:-default}
    18  # extract the required TLS and mTLS files
    19  kubectl get secret allocator-client.default -n ${NAMESPACE} -ojsonpath="{.data.tls\.crt}" | base64 -d > client.crt
    20  kubectl get secret allocator-client.default -n ${NAMESPACE} -ojsonpath="{.data.tls\.key}" | base64 -d > client.key
    21  kubectl get secret allocator-tls-ca -n agones-system -ojsonpath='{.data.tls-ca\.crt}' | base64 -d > ca.crt
    22  
    23  # The number of times you want allocation test to be run
    24  TESTRUNSCOUNT=${TESTRUNSCOUNT:-3}
    25  EXTERNAL_IP=$(kubectl get services agones-allocator -n agones-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
    26  KEY_FILE=${KEY_FILE:-client.key}
    27  CERT_FILE=${CERT_FILE:-client.crt}
    28  TLS_CA_FILE=${TLS_CA_FILE:-ca.crt}
    29  
    30  counter=1
    31  while [ $counter -le $TESTRUNSCOUNT ]
    32  do
    33      echo "Run number: " $counter
    34      go run allocationload/allocationload.go --ip ${EXTERNAL_IP} --port 443 --namespace ${NAMESPACE} --key ${KEY_FILE} --cert ${CERT_FILE} --cacert ${TLS_CA_FILE} --numberofclients $1 --perclientallocations $2 2>>./allocation_test_results.txt
    35      sleep 1200
    36      ((counter++))
    37  done