From 68bf02400559692f249268cefc685eec2ddab47e Mon Sep 17 00:00:00 2001 From: Jacques ROUSSEL Date: Fri, 7 Feb 2025 16:26:25 +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. --- src/helm/impress/Chart.yaml | 2 +- src/helm/impress/README.md | 3 +++ src/helm/impress/generate-readme.sh | 2 +- src/helm/impress/templates/backend_deployment.yaml | 13 +++++++++++++ src/helm/impress/templates/frontend_deployment.yaml | 13 +++++++++++++ .../impress/templates/yprovider_deployment.yaml | 13 +++++++++++++ src/helm/impress/values.yaml | 11 +++++++++++ 7 files changed, 55 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/helm/impress/generate-readme.sh diff --git a/src/helm/impress/Chart.yaml b/src/helm/impress/Chart.yaml index ff5ea89b..2e9cfb99 100644 --- a/src/helm/impress/Chart.yaml +++ b/src/helm/impress/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 type: application name: docs -version: 2.1.0 +version: 2.1.0-beta-1 appVersion: latest diff --git a/src/helm/impress/README.md b/src/helm/impress/README.md index 999dc479..4b72802a 100644 --- a/src/helm/impress/README.md +++ b/src/helm/impress/README.md @@ -131,6 +131,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 @@ -180,6 +181,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 @@ -261,3 +263,4 @@ | `yProvider.persistence.volume-name.mountPath` | Path where the volume should be mounted to | | | `yProvider.extraVolumeMounts` | Additional volumes to mount on the yProvider. | `[]` | | `yProvider.extraVolumes` | Additional volumes to mount on the yProvider. | `[]` | +| `yProvider.pdb.enabled` | Enable pdb on yProvider | `true` | diff --git a/src/helm/impress/generate-readme.sh b/src/helm/impress/generate-readme.sh old mode 100644 new mode 100755 index b8224b08..cc689ba9 --- a/src/helm/impress/generate-readme.sh +++ b/src/helm/impress/generate-readme.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash docker image ls | grep readme-generator-for-helm if [ "$?" -ne "0" ]; then diff --git a/src/helm/impress/templates/backend_deployment.yaml b/src/helm/impress/templates/backend_deployment.yaml index 4af24cae..192f7a08 100644 --- a/src/helm/impress/templates/backend_deployment.yaml +++ b/src/helm/impress/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 "impress.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/impress/templates/frontend_deployment.yaml b/src/helm/impress/templates/frontend_deployment.yaml index 97cf4601..187506aa 100644 --- a/src/helm/impress/templates/frontend_deployment.yaml +++ b/src/helm/impress/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 "impress.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/impress/templates/yprovider_deployment.yaml b/src/helm/impress/templates/yprovider_deployment.yaml index c59751f6..15020d8d 100644 --- a/src/helm/impress/templates/yprovider_deployment.yaml +++ b/src/helm/impress/templates/yprovider_deployment.yaml @@ -138,3 +138,16 @@ spec: emptyDir: {} {{- end }} {{- end }} +--- +{{ if .Values.yProvider.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/impress/values.yaml b/src/helm/impress/values.yaml index d429937f..75ee8f7c 100644 --- a/src/helm/impress/values.yaml +++ b/src/helm/impress/values.yaml @@ -308,6 +308,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 @@ -403,6 +406,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: @@ -571,3 +578,7 @@ yProvider: ## @param yProvider.extraVolumes Additional volumes to mount on the yProvider. extraVolumes: [] + + ## @param yProvider.pdb.enabled Enable pdb on yProvider + pdb: + enabled: true