From 0a8d87895b2e7146e9b7b1a270612c96a3ad15fa Mon Sep 17 00:00:00 2001 From: Valentin T <389922+valentintorikian@users.noreply.github.com> Date: Fri, 18 Nov 2022 11:27:05 -0500 Subject: [PATCH] Implemented PodDisruptionBudget on relevant deployments (#2740) - added a pdb on the ping deployment - added a pdb on the allocator deployment - default to no creation of pdb, opt-in install Co-authored-by: Robert Bailey --- install/helm/agones/templates/ping.yaml | 16 ++++++++++++++++ .../agones/templates/service/allocation.yaml | 17 ++++++++++++++++- install/helm/agones/values.yaml | 6 ++++++ .../en/docs/Installation/Install Agones/helm.md | 15 +++++++++++---- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/install/helm/agones/templates/ping.yaml b/install/helm/agones/templates/ping.yaml index cc61442135..bec32a5d26 100644 --- a/install/helm/agones/templates/ping.yaml +++ b/install/helm/agones/templates/ping.yaml @@ -89,6 +89,22 @@ spec: {{- if .Values.agones.image.controller.pullSecret }} imagePullSecrets: - name: {{.Values.agones.image.controller.pullSecret}} +{{- end }} +{{- if .Values.agones.ping.pdb.enabled }} +--- +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: agones-ping-pdb +spec: + minAvailable: {{ .Values.agones.ping.pdb.minAvailable }} + maxUnavailable: {{ .Values.agones.ping.pdb.maxUnavailable }} + selector: + matchLabels: + agones.dev/role: ping + app: {{ template "agones.name" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} {{- end }} {{- if .Values.agones.ping.http.expose }} --- diff --git a/install/helm/agones/templates/service/allocation.yaml b/install/helm/agones/templates/service/allocation.yaml index fea314fa6a..b0e360ef2e 100644 --- a/install/helm/agones/templates/service/allocation.yaml +++ b/install/helm/agones/templates/service/allocation.yaml @@ -282,7 +282,22 @@ spec: imagePullSecrets: - name: {{.Values.agones.image.controller.pullSecret}} {{- end }} - +{{- if .Values.agones.allocator.pdb.enabled }} +--- +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: agones-allocator-pdb +spec: + minAvailable: {{ .Values.agones.allocator.pdb.minAvailable }} + maxUnavailable: {{ .Values.agones.allocator.pdb.maxUnavailable }} + selector: + matchLabels: + multicluster.agones.dev/role: allocator + app: {{ template "agones.name" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- end }} --- # Create a ClusterRole in that grants access to the agones allocation api apiVersion: rbac.authorization.k8s.io/v1 diff --git a/install/helm/agones/values.yaml b/install/helm/agones/values.yaml index 7aec49498d..078a0ce9b2 100644 --- a/install/helm/agones/values.yaml +++ b/install/helm/agones/values.yaml @@ -96,6 +96,9 @@ agones: allocationBatchWaitTime: 500ms ping: install: true + pdb: + enabled: false + minAvailable: 1 updateStrategy: {} resources: {} # requests: @@ -140,6 +143,9 @@ agones: timeoutSeconds: 1 allocator: install: true + pdb: + enabled: false + minAvailable: 1 updateStrategy: {} apiServerQPS: 400 apiServerQPSBurst: 500 diff --git a/site/content/en/docs/Installation/Install Agones/helm.md b/site/content/en/docs/Installation/Install Agones/helm.md index 44cff61d9e..7aec4f83f4 100644 --- a/site/content/en/docs/Installation/Install Agones/helm.md +++ b/site/content/en/docs/Installation/Install Agones/helm.md @@ -211,13 +211,20 @@ The following tables lists the configurable parameters of the Agones chart and t | `gameservers.podPreserveUnknownFields` | Disable [field pruning][pruning] and schema validation on the Pod template for a [GameServer][gameserver] definition | `false` | | `helm.installTests` | Add an ability to run `helm test agones` to verify the installation | `false` | | `agones.controller.allocationBatchWaitTime` | Wait time between each allocation batch when performing allocations in controller mode | `500ms` | -| `agones.allocator.updateStrategy` | The [strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) to apply to the ping deployment | `{}` | -| `agones.ping.updateStrategy` | The [strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) to apply to the allocator deployment | `{}` | +| `agones.allocator.updateStrategy` | The [strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) to apply to the ping deployment | `{}` | +| `agones.ping.updateStrategy` | The [strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) to apply to the allocator deployment | `{}` | {{% feature publishVersion="1.28.0" %}} **New Configuration Features:** -| Parameter | Description | Default | -| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | + +| Parameter | Description | Default | +|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| +| `agones.allocator.pdb.enabled` | Set to `true` to enable the creation of a [PodDisruptionBudget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) for the allocator deployment | `false` | +| `agones.allocator.pdb.minAvailable` | Description of the number of pods from that set that must still be available after the eviction, even in the absence of the evicted pod. Can be either an absolute number or a percentage. | `1` | +| `agones.allocator.pdb.maxUnavailable` | Description of the number of pods from that set that can be unavailable after the eviction. It can be either an absolute number or a percentage. | \`\` | +| `agones.ping.pdb.enabled` | Set to `true` to enable the creation of a [PodDisruptionBudget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) for the ping deployment | `false` | +| `agones.ping.pdb.minAvailable` | Description of the number of pods from that set that must still be available after the eviction, even in the absence of the evicted pod. Can be either an absolute number or a percentage. | `1` | +| `agones.ping.pdb.maxUnavailable` | Description of the number of pods from that set that can be unavailable after the eviction. It can be either an absolute number or a percentage. | \`\` | {{% /feature %}} [toleration]: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/