agones.dev/agones@v1.53.0/test/load/allocation/configure-agones.sh (about) 1 # Copyright 2022 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 set -e 18 19 20 function main() { 21 echo "Make sure you have kubectl pointed at the right cluster" 22 tmp_dir=$(mktemp -d) 23 24 patch_controller="${tmp_dir}/patch-controller.yaml" 25 cat << EOF > "${patch_controller}" 26 spec: 27 template: 28 spec: 29 affinity: 30 nodeAffinity: 31 \$retainKeys: 32 - requiredDuringSchedulingIgnoredDuringExecution 33 requiredDuringSchedulingIgnoredDuringExecution: 34 nodeSelectorTerms: 35 - matchExpressions: 36 - key: agones.dev/agones-system 37 operator: Exists 38 containers: 39 - name: agones-controller 40 resources: 41 limits: 42 cpu: "4" 43 memory: 4000Mi 44 requests: 45 cpu: "4" 46 memory: 4000Mi 47 EOF 48 49 kubectl patch deployment -n agones-system agones-controller --patch "$(cat "${patch_controller}")" 50 51 echo "Restarting controller pods" 52 kubectl get pods -n agones-system -o=name | grep "agones-controller" | xargs kubectl delete -n agones-system 53 54 patch_allocator="${tmp_dir}/patch-allocator.yaml" 55 cat << EOF > "${patch_allocator}" 56 spec: 57 template: 58 spec: 59 affinity: 60 nodeAffinity: 61 \$retainKeys: 62 - requiredDuringSchedulingIgnoredDuringExecution 63 requiredDuringSchedulingIgnoredDuringExecution: 64 nodeSelectorTerms: 65 - matchExpressions: 66 - key: agones.dev/agones-system 67 operator: Exists 68 containers: 69 - name: agones-allocator 70 resources: 71 limits: 72 cpu: "4" 73 memory: 4000Mi 74 requests: 75 cpu: "4" 76 memory: 4000Mi 77 EOF 78 79 kubectl patch deployment -n agones-system agones-allocator --patch "$(cat "${patch_allocator}")" 80 echo "Restarting allocator pods" 81 kubectl get pods -n agones-system -o=name | grep "agones-allocator" | xargs kubectl delete -n agones-system 82 83 patch_ping="${tmp_dir}/patch-ping.yaml" 84 cat << EOF > "${patch_ping}" 85 spec: 86 template: 87 spec: 88 affinity: 89 nodeAffinity: 90 \$retainKeys: 91 - requiredDuringSchedulingIgnoredDuringExecution 92 requiredDuringSchedulingIgnoredDuringExecution: 93 nodeSelectorTerms: 94 - matchExpressions: 95 - key: agones.dev/agones-system 96 operator: Exists 97 EOF 98 99 kubectl patch deployment -n agones-system agones-ping --patch "$(cat "${patch_ping}")" 100 echo "Restarting ping pods" 101 kubectl get pods -n agones-system -o=name | grep "agones-ping" | xargs kubectl delete -n agones-system 102 } 103 104 main "$@"