Skip to content

Commit

Permalink
feat: pod disruption budget
Browse files Browse the repository at this point in the history
Added a flag to enable/disable a [pod disruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/), helping Connaisseur to be always available.

fixes #1850
  • Loading branch information
phbelitz committed Dec 6, 2024
1 parent 5466ad5 commit ab72355
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charts/connaisseur/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ Create the name of the redis tls secret
{{- include "connaisseur.name" . }}-redis-tls
{{- end -}}

{{/*
Create the name of the pod disruption budget
*/}}
{{- define "connaisseur.podDisruptionBudget" -}}
{{- include "connaisseur.name" . }}-pod-disruption-budget
{{- end -}}

{{/*
Extract Kubernetes Minor Version.
*/}}
Expand Down
21 changes: 21 additions & 0 deletions charts/connaisseur/templates/pod_disruption_budget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{ if .Values.kubernetes.podDisruptionBudget -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "connaisseur.podDisruptionBudget" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "connaisseur.labels" . | nindent 4 }}
spec:
{{- with .Values.kubernetes.podDisruptionBudget }}
{{- if hasKey . "minAvailable" }}
minAvailable: {{ .minAvailable }}
{{- end }}
{{- if hasKey . "maxUnavailable" }}
maxUnavailable: {{ .maxUnavailable }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "connaisseur.selectorLabels" . | nindent 8 }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/connaisseur/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ kubernetes:
# (except for pods – see kubernetes.deployment.podLabels for that)
additionalLabels: {}

# activate pod disruption budget
# can set `minAvailable` and `maxUnavailable` values
podDisruptionBudget: {}

# -----------------------------------------------------

# changes to connaisseur application logic
Expand Down

0 comments on commit ab72355

Please sign in to comment.