-
Notifications
You must be signed in to change notification settings - Fork 1
[LFXV2-1166] Add pod disruption budget support #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Copyright The Linux Foundation and each contributor to LFX. | ||
| # SPDX-License-Identifier: MIT | ||
| {{- if .Values.podDisruptionBudget.enabled }} | ||
| {{- if and (hasKey .Values.podDisruptionBudget "minAvailable") (hasKey .Values.podDisruptionBudget "maxUnavailable") }} | ||
| {{- fail "podDisruptionBudget: cannot set both minAvailable and maxUnavailable" }} | ||
| {{- end }} | ||
| --- | ||
| apiVersion: policy/v1 | ||
| kind: PodDisruptionBudget | ||
| metadata: | ||
| name: {{ .Chart.Name }} | ||
| namespace: {{ .Release.Namespace }} | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app: {{ .Chart.Name }} | ||
| {{- if hasKey .Values.podDisruptionBudget "minAvailable" }} | ||
| minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} | ||
| {{- end }} | ||
| {{- if hasKey .Values.podDisruptionBudget "maxUnavailable" }} | ||
| maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} | ||
| {{- end }} | ||
|
Comment on lines
+17
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing validation: PDB requires at least one of When 🐛 Proposed fix to add validationAdd this validation after line 6: {{- if and (hasKey .Values.podDisruptionBudget "minAvailable") (hasKey .Values.podDisruptionBudget "maxUnavailable") }}
{{- fail "podDisruptionBudget: cannot set both minAvailable and maxUnavailable" }}
{{- end }}
+{{- if not (or (hasKey .Values.podDisruptionBudget "minAvailable") (hasKey .Values.podDisruptionBudget "maxUnavailable")) }}
+ {{- fail "podDisruptionBudget: must set either minAvailable or maxUnavailable when enabled" }}
+{{- end }}
---🤖 Prompt for AI Agents |
||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,13 @@ podAnnotations: {} | |||||||||
| # environment: production | ||||||||||
| podLabels: {} | ||||||||||
|
|
||||||||||
| # podDisruptionBudget configures a PodDisruptionBudget for the deployment. | ||||||||||
| # Only one of minAvailable or maxUnavailable may be set (not both). | ||||||||||
| podDisruptionBudget: | ||||||||||
| enabled: false | ||||||||||
| # minAvailable: 1 | ||||||||||
| # maxUnavailable: 1 | ||||||||||
|
Comment on lines
+23
to
+24
|
||||||||||
| # minAvailable: 1 | |
| # maxUnavailable: 1 | |
| # minAvailable: 1 # Specify exactly one of minAvailable or maxUnavailable when enabled=true | |
| # maxUnavailable: 1 # Mutually exclusive with minAvailable; uncomment only one of these fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
podDisruptionBudget.enabledis true, this template can render an invalid PDB if neitherminAvailablenormaxUnavailableis set, and it can also render an invalid PDB if both are set. Add Helm-time validation (e.g.,fail/required) to enforce that exactly one of these values is provided when enabled.