Skip to content

Commit

Permalink
feat(helm): add topologySpreadConstraints and PDB
Browse files Browse the repository at this point in the history
  • Loading branch information
the-technat committed Feb 26, 2024
1 parent 357009a commit 6a0bbda
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/podinfo/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,7 @@ spec:
secret:
secretName: {{ template "podinfo.tlsSecretName" . }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/podinfo/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if and .Values.podDisruptionBudget (gt (int .Values.replicaCount) 1) }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "podinfo.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "podinfo.selectorLabels" . | nindent 6 }}
{{- toYaml .Values.podDisruptionBudget | nindent 2 }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/podinfo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ affinity: {}

podAnnotations: {}

# https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
topologySpreadConstraints: []

# Disruption budget will be configured only when the replicaCount is greater than 1
podDisruptionBudget: {}
# maxUnavailable: 1

# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
probes:
readiness:
Expand Down

0 comments on commit 6a0bbda

Please sign in to comment.