From 6f15a797e1bb84a5462aa07eb720e45df6c1e57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Mon, 9 Sep 2024 18:34:39 +0200 Subject: [PATCH] feat: allow to define pod disruption budgets --- charts/penpot/Chart.yaml | 2 ++ charts/penpot/README.md | 12 +++++++ .../templates/backend-deployment-pdb.yml | 20 +++++++++++ .../templates/exporter-deployment-pdb.yml | 20 +++++++++++ .../templates/frontend-deployment-pdb.yml | 20 +++++++++++ charts/penpot/values.yaml | 36 +++++++++++++++++++ 6 files changed, 110 insertions(+) create mode 100644 charts/penpot/templates/backend-deployment-pdb.yml create mode 100644 charts/penpot/templates/exporter-deployment-pdb.yml create mode 100644 charts/penpot/templates/frontend-deployment-pdb.yml diff --git a/charts/penpot/Chart.yaml b/charts/penpot/Chart.yaml index 795713e..48c7b4d 100644 --- a/charts/penpot/Chart.yaml +++ b/charts/penpot/Chart.yaml @@ -39,6 +39,8 @@ annotations: url: https://penpot.app/dev-diaries.html artifacthub.io/containsSecurityUpdates: "false" artifacthub.io/changes: | + - kind: added + description: Allow to define pod disruption budgets. - kind: changed description: Bump penpot to 2.1.4. - kind: changed diff --git a/charts/penpot/README.md b/charts/penpot/README.md index 5410f52..821450d 100644 --- a/charts/penpot/README.md +++ b/charts/penpot/README.md @@ -155,6 +155,10 @@ helm install my-release -f values.yaml penpot/penpot | backend.image.repository | string | `"penpotapp/backend"` | The Docker repository to pull the image from. | | backend.image.tag | string | `"2.1.4"` | The image tag to use. | | backend.nodeSelector | object | `{}` | Node labels for Penpot pods assignment. Check [the official doc](https://kubernetes.io/docs/user-guide/node-selection/) | +| backend.pdb | object | `{"enabled":false,"maxUnavailable":null,"minAvailable":null}` | Configure Pod Disruption Budget for the backend pods. Check [the official doc](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) | +| backend.pdb.enabled | bool | `false` | Enable Pod Disruption Budget for the backend pods. | +| backend.pdb.maxUnavailable | int,string | `nil` | The number or percentage of pods from that set that can be unavailable after the eviction (e.g.: 3, "10%"). | +| backend.pdb.minAvailable | int,string | `nil` | The number or percentage of pods from that set that must still be available after the eviction (e.g.: 3, "10%"). | | backend.podAnnotations | object | `{}` | An optional map of annotations to be applied to the controller Pods | | backend.podLabels | object | `{}` | An optional map of labels to be applied to the controller Pods | | backend.podSecurityContext | object | `{"fsGroup":1001}` | Configure Pods Security Context. Check [the official doc](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) | @@ -177,6 +181,10 @@ helm install my-release -f values.yaml penpot/penpot | frontend.image.repository | string | `"penpotapp/frontend"` | The Docker repository to pull the image from. | | frontend.image.tag | string | `"2.1.4"` | The image tag to use. | | frontend.nodeSelector | object | `{}` | Node labels for Penpot pods assignment. Check [the official doc](https://kubernetes.io/docs/user-guide/node-selection/) | +| frontend.pdb | object | `{"enabled":false,"maxUnavailable":null,"minAvailable":null}` | Configure Pod Disruption Budget for the frontend pods. Check [the official doc](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) | +| frontend.pdb.enabled | bool | `false` | Enable Pod Disruption Budget for the frontend pods. | +| frontend.pdb.maxUnavailable | int,string | `nil` | The number or percentage of pods from that set that can be unavailable after the eviction (e.g.: 3, "10%"). | +| frontend.pdb.minAvailable | int,string | `nil` | The number or percentage of pods from that set that must still be available after the eviction (e.g.: 3, "10%"). | | frontend.podAnnotations | object | `{}` | An optional map of annotations to be applied to the controller Pods | | frontend.podLabels | object | `{}` | An optional map of labels to be applied to the controller Pods | | frontend.podSecurityContext | object | `{}` | Configure Pods Security Context. Check [the official doc](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) | @@ -199,6 +207,10 @@ helm install my-release -f values.yaml penpot/penpot | exporter.image.repository | string | `"penpotapp/exporter"` | The Docker repository to pull the image from. | | exporter.image.tag | string | `"2.1.4"` | The image tag to use. | | exporter.nodeSelector | object | `{}` | Node labels for Penpot pods assignment. Check [the official doc](https://kubernetes.io/docs/user-guide/node-selection/) | +| exporter.pdb | object | `{"enabled":false,"maxUnavailable":null,"minAvailable":null}` | Configure Pod Disruption Budget for the exporter pods. Check [the official doc](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) | +| exporter.pdb.enabled | bool | `false` | Enable Pod Disruption Budget for the exporter pods. | +| exporter.pdb.maxUnavailable | int,string | `nil` | The number or percentage of pods from that set that can be unavailable after the eviction (e.g.: 3, "10%"). | +| exporter.pdb.minAvailable | int,string | `nil` | The number or percentage of pods from that set that must still be available after the eviction (e.g.: 3, "10%"). | | exporter.podAnnotations | object | `{}` | An optional map of annotations to be applied to the controller Pods | | exporter.podLabels | object | `{}` | An optional map of labels to be applied to the controller Pods | | exporter.podSecurityContext | object | `{"fsGroup":1001}` | Configure Pods Security Context. Check [the official doc](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) | diff --git a/charts/penpot/templates/backend-deployment-pdb.yml b/charts/penpot/templates/backend-deployment-pdb.yml new file mode 100644 index 0000000..573cdbc --- /dev/null +++ b/charts/penpot/templates/backend-deployment-pdb.yml @@ -0,0 +1,20 @@ +{{- if .Values.backend.pdb.enabled -}} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "penpot.fullname" . }}-backend + namespace: {{ .Release.Namespace }} + labels: + {{- include "penpot.labels" . | nindent 4 }} +spec: + {{- if .Values.backend.pdb.minAvailable }} + minAvailable: {{ .Values.backend.pdb.minAvailable }} + {{- else if .Values.backend.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.backend.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + app: penpot-backend +{{- end -}} diff --git a/charts/penpot/templates/exporter-deployment-pdb.yml b/charts/penpot/templates/exporter-deployment-pdb.yml new file mode 100644 index 0000000..3ebac49 --- /dev/null +++ b/charts/penpot/templates/exporter-deployment-pdb.yml @@ -0,0 +1,20 @@ +{{- if .Values.exporter.pdb.enabled -}} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "penpot.fullname" . }}-exporter + namespace: {{ .Release.Namespace }} + labels: + {{- include "penpot.labels" . | nindent 4 }} +spec: + {{- if .Values.exporter.pdb.minAvailable }} + minAvailable: {{ .Values.exporter.pdb.minAvailable }} + {{- else if .Values.exporter.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.exporter.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + app: penpot-exporter +{{- end -}} diff --git a/charts/penpot/templates/frontend-deployment-pdb.yml b/charts/penpot/templates/frontend-deployment-pdb.yml new file mode 100644 index 0000000..b7c538a --- /dev/null +++ b/charts/penpot/templates/frontend-deployment-pdb.yml @@ -0,0 +1,20 @@ +{{- if .Values.frontend.pdb.enabled -}} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "penpot.fullname" . }}-frontend + namespace: {{ .Release.Namespace }} + labels: + {{- include "penpot.labels" . | nindent 4 }} +spec: + {{- if .Values.frontend.pdb.minAvailable }} + minAvailable: {{ .Values.frontend.pdb.minAvailable }} + {{- else if .Values.frontend.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.frontend.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + app: penpot-frontend +{{- end -}} diff --git a/charts/penpot/values.yaml b/charts/penpot/values.yaml index cd26663..fe15494 100644 --- a/charts/penpot/values.yaml +++ b/charts/penpot/values.yaml @@ -367,6 +367,18 @@ backend: # -- The requested resources for the Penpot backend containers # @section -- Backend parameters requests: {} + # -- Configure Pod Disruption Budget for the backend pods. Check [the official doc](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) + # @section -- Backend parameters + pdb: + # -- Enable Pod Disruption Budget for the backend pods. + # @section -- Backend parameters + enabled: false + # -- (int,string) The number or percentage of pods from that set that must still be available after the eviction (e.g.: 3, "10%"). + # @section -- Backend parameters + minAvailable: + # -- (int,string) The number or percentage of pods from that set that can be unavailable after the eviction (e.g.: 3, "10%"). + # @section -- Backend parameters + maxUnavailable: frontend: image: @@ -422,6 +434,18 @@ frontend: # -- The requested resources for the Penpot frontend containers # @section -- Frontend parameters requests: {} + # -- Configure Pod Disruption Budget for the frontend pods. Check [the official doc](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) + # @section -- Frontend parameters + pdb: + # -- Enable Pod Disruption Budget for the frontend pods. + # @section -- Frontend parameters + enabled: false + # -- (int,string) The number or percentage of pods from that set that must still be available after the eviction (e.g.: 3, "10%"). + # @section -- Frontend parameters + minAvailable: + # -- (int,string) The number or percentage of pods from that set that can be unavailable after the eviction (e.g.: 3, "10%"). + # @section -- Frontend parameters + maxUnavailable: exporter: image: @@ -485,6 +509,18 @@ exporter: # -- The requested resources for the Penpot frontend containers # @section -- Exporter parameters requests: {} + # -- Configure Pod Disruption Budget for the exporter pods. Check [the official doc](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) + # @section -- Exporter parameters + pdb: + # -- Enable Pod Disruption Budget for the exporter pods. + # @section -- Exporter parameters + enabled: false + # -- (int,string) The number or percentage of pods from that set that must still be available after the eviction (e.g.: 3, "10%"). + # @section -- Exporter parameters + minAvailable: + # -- (int,string) The number or percentage of pods from that set that can be unavailable after the eviction (e.g.: 3, "10%"). + # @section -- Exporter parameters + maxUnavailable: # @section -- Persistence parameters persistence: