Skip to content
Open
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
23 changes: 23 additions & 0 deletions charts/lfx-v2-project-service/templates/pdb.yaml
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 +3 to +22
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

If podDisruptionBudget.enabled is true but neither minAvailable nor maxUnavailable is specified, this template will create a PDB with no disruption constraint — effectively allowing all pods to be disrupted simultaneously. This is a valid Kubernetes resource but almost certainly a misconfiguration. Consider adding a validation check to fail with a helpful error message when the PDB is enabled without either field, for example:

{{- if and .Values.podDisruptionBudget.enabled (not (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable)) }}
{{- fail "podDisruptionBudget.enabled is true but neither minAvailable nor maxUnavailable is set" }}
{{- end }}

Copilot uses AI. Check for mistakes.
{{- end }}
7 changes: 7 additions & 0 deletions charts/lfx-v2-project-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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 +39 to +42
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The podDisruptionBudget section is missing the descriptive comment above it that every other top-level section in this file has (e.g., # image is the configuration for the container images, # replicaCount is the number of replicas for the deployment, # resources is the configuration for container resource limits and requests). Please add a comment like # podDisruptionBudget is the configuration for the PodDisruptionBudget resource to stay consistent with the rest of the file.

Copilot uses AI. Check for mistakes.

# resources is the configuration for container resource limits and requests
resources:
# limits is the maximum amount of resources the container can use
Expand Down