Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions charts/flagsmith/templates/pdb-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.pdb.api.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other resources in the chart include standard labels in their metadata block. The PDB templates are missing them. Could you add them so they're consistent with the rest of the chart?

namespace: {{ .Release.Namespace }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the chart uses {{ include "flagsmith.namespace" . }}, which supports namespace overrides.

Please switch to the helper for consistency.

name: {{ template "flagsmith.fullname" . }}-api-pdb
spec:
selector:
matchLabels:
{{- include "flagsmith.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: api
{{- if and .Values.pdb.api.minAvailable (not (hasKey .Values.pdb.api "maxUnavailable")) }}
minAvailable: {{ .Values.pdb.api.minAvailable }}
{{- else if .Values.pdb.api.maxUnavailable }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting maxUnavailable to 0 would silently skip rendering both fields, producing an invalid PDB. Using hasKey instead would handle this correctly

maxUnavailable: {{ .Values.pdb.api.maxUnavailable }}
{{- end }}
{{- if .Values.pdb.api.unhealthyPodEvictionPolicy }}
unhealthyPodEvictionPolicy: {{ .Values.pdb.api.unhealthyPodEvictionPolicy }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/flagsmith/templates/pdb-frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.pdb.frontend.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
namespace: {{ .Release.Namespace }}
name: {{ template "flagsmith.fullname" . }}-frontend-pdb
spec:
selector:
matchLabels:
{{- include "flagsmith.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: frontend
{{- if and .Values.pdb.frontend.minAvailable (not (hasKey .Values.pdb.frontend "maxUnavailable")) }}
minAvailable: {{ .Values.pdb.frontend.minAvailable }}
{{- else if .Values.pdb.frontend.maxUnavailable }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting maxUnavailable to 0 would silently skip rendering both fields, producing an invalid PDB. Using hasKey instead would handle this correctly

maxUnavailable: {{ .Values.pdb.frontend.maxUnavailable }}
{{- end }}
{{- if .Values.pdb.frontend.unhealthyPodEvictionPolicy }}
unhealthyPodEvictionPolicy: {{ .Values.pdb.frontend.unhealthyPodEvictionPolicy }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/flagsmith/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,18 @@ hpa:
maxReplicas: 10
targetCPUUtilization: 50

pdb:
api:
enabled: false
minAvailable: 1
# maxUnavailable: 1
# unhealthyPodEvictionPolicy: "AlwaysAllow"
frontend:
enabled: false
minAvailable: 1
# maxUnavailable: 1
# unhealthyPodEvictionPolicy: "AlwaysAllow"

ingress:
frontend:
enabled: false
Expand Down
Loading