From 2cd4a6efa886769536622c88d029ac6b8f9861c5 Mon Sep 17 00:00:00 2001 From: Jacques ROUSSEL Date: Wed, 5 Feb 2025 22:22:50 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(helm)=20add=20pdbs=20to=20deployments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to avoid a service interruption during a Kubernetes (k8s) upgrade, we add a Pod Disruption Budget (PDB) to deployments. --- .github/workflows/release-helm-chart.yaml | 4 +--- CHANGELOG.md | 1 + src/helm/meet/Chart.yaml | 2 +- src/helm/meet/README.md | 4 ++++ .../meet/templates/backend_deployment.yaml | 13 ++++++++++++ .../meet/templates/celery_deployment.yaml | 13 ++++++++++++ .../meet/templates/frontend_deployment.yaml | 13 ++++++++++++ .../meet/templates/summary_deployment.yaml | 13 ++++++++++++ src/helm/meet/values.yaml | 21 +++++++++++++++---- 9 files changed, 76 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-helm-chart.yaml b/.github/workflows/release-helm-chart.yaml index a513588e..22ec891a 100644 --- a/.github/workflows/release-helm-chart.yaml +++ b/.github/workflows/release-helm-chart.yaml @@ -3,10 +3,8 @@ run-name: Release Chart on: push: - branches: - - 'main' paths: - - ./src/helm/meet/** + - src/helm/meet/** jobs: release: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce95447..d6a4630a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + # Changelog All notable changes to this project will be documented in this file. diff --git a/src/helm/meet/Chart.yaml b/src/helm/meet/Chart.yaml index 1f36723e..b49aa657 100644 --- a/src/helm/meet/Chart.yaml +++ b/src/helm/meet/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v2 type: application name: meet -version: 0.0.2 +version: 0.0.3 diff --git a/src/helm/meet/README.md b/src/helm/meet/README.md index fec75fb5..bac51083 100644 --- a/src/helm/meet/README.md +++ b/src/helm/meet/README.md @@ -82,6 +82,7 @@ | `backend.persistence.volume-name.mountPath` | Path where the volume should be mounted to | | | `backend.extraVolumeMounts` | Additional volumes to mount on the backend. | `[]` | | `backend.extraVolumes` | Additional volumes to mount on the backend. | `[]` | +| `backend.pdb.enabled` | Enable pdb on backend | `true` | ### frontend @@ -131,6 +132,7 @@ | `frontend.persistence.volume-name.mountPath` | Path where the volume should be mounted to | | | `frontend.extraVolumeMounts` | Additional volumes to mount on the frontend. | `[]` | | `frontend.extraVolumes` | Additional volumes to mount on the frontend. | `[]` | +| `frontend.pdb.enabled` | Enable pdb on frontend | `true` | ### posthog @@ -208,6 +210,7 @@ | `summary.persistence.volume-name.mountPath` | Path where the volume should be mounted to | | | `summary.extraVolumeMounts` | Additional volumes to mount on the summary. | `[]` | | `summary.extraVolumes` | Additional volumes to mount on the summary. | `[]` | +| `summary.pdb.enabled` | Enable pdb on summary | `true` | ### celery @@ -255,3 +258,4 @@ | `celery.persistence.volume-name.mountPath` | Path where the volume should be mounted to | | | `celery.extraVolumeMounts` | Additional volumes to mount on the celery. | `[]` | | `celery.extraVolumes` | Additional volumes to mount on the celery. | `[]` | +| `celery.pdb.enabled` | Enable pdb on celery | `false` | diff --git a/src/helm/meet/templates/backend_deployment.yaml b/src/helm/meet/templates/backend_deployment.yaml index 77e5aef0..b4c69adb 100644 --- a/src/helm/meet/templates/backend_deployment.yaml +++ b/src/helm/meet/templates/backend_deployment.yaml @@ -138,3 +138,16 @@ spec: emptyDir: {} {{- end }} {{- end }} +--- +{{ if .Values.backend.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + {{- include "meet.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/meet/templates/celery_deployment.yaml b/src/helm/meet/templates/celery_deployment.yaml index ac151774..4f94ce7f 100644 --- a/src/helm/meet/templates/celery_deployment.yaml +++ b/src/helm/meet/templates/celery_deployment.yaml @@ -138,3 +138,16 @@ spec: emptyDir: {} {{- end }} {{- end }} +--- +{{ if .Values.celery.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + {{- include "meet.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/meet/templates/frontend_deployment.yaml b/src/helm/meet/templates/frontend_deployment.yaml index b51107c5..f7d88b82 100644 --- a/src/helm/meet/templates/frontend_deployment.yaml +++ b/src/helm/meet/templates/frontend_deployment.yaml @@ -138,3 +138,16 @@ spec: emptyDir: {} {{- end }} {{- end }} +--- +{{ if .Values.frontend.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + {{- include "meet.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/meet/templates/summary_deployment.yaml b/src/helm/meet/templates/summary_deployment.yaml index acfbe2ea..a957ee65 100644 --- a/src/helm/meet/templates/summary_deployment.yaml +++ b/src/helm/meet/templates/summary_deployment.yaml @@ -138,3 +138,16 @@ spec: emptyDir: {} {{- end }} {{- end }} +--- +{{ if .Values.summary.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + {{- include "meet.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/meet/values.yaml b/src/helm/meet/values.yaml index e55573ed..3acd0756 100644 --- a/src/helm/meet/values.yaml +++ b/src/helm/meet/values.yaml @@ -120,8 +120,8 @@ backend: targetPort: 8000 annotations: {} - ## @param backend.migrate.command backend migrate command - ## @param backend.migrate.restartPolicy backend migrate job restart policy + ## @param backend.migrate.command backend migrate command + ## @param backend.migrate.restartPolicy backend migrate job restart policy migrate: command: - "python" @@ -130,8 +130,8 @@ backend: - "--no-input" restartPolicy: Never - ## @param backend.createsuperuser.command backend migrate command - ## @param backend.createsuperuser.restartPolicy backend migrate job restart policy + ## @param backend.createsuperuser.command backend migrate command + ## @param backend.createsuperuser.restartPolicy backend migrate job restart policy createsuperuser: command: - "/bin/sh" @@ -184,6 +184,9 @@ backend: ## @param backend.extraVolumes Additional volumes to mount on the backend. extraVolumes: [] + ## @param backend.pdb.enabled Enable pdb on backend + pdb: + enabled: true ## @section frontend @@ -279,6 +282,10 @@ frontend: ## @param frontend.extraVolumes Additional volumes to mount on the frontend. extraVolumes: [] + ## @param frontend.pdb.enabled Enable pdb on frontend + pdb: + enabled: true + ## @section posthog posthog: @@ -443,6 +450,9 @@ summary: ## @param summary.extraVolumes Additional volumes to mount on the summary. extraVolumes: [] + ## @param summary.pdb.enabled Enable pdb on summary + pdb: + enabled: true ## @section celery @@ -533,3 +543,6 @@ celery: ## @param celery.extraVolumes Additional volumes to mount on the celery. extraVolumes: [] + ## @param celery.pdb.enabled Enable pdb on celery + pdb: + enabled: false