From 1f1f0d0480d77fce425515357a072644bb6ea323 Mon Sep 17 00:00:00 2001 From: Mike Camp Date: Tue, 15 Sep 2026 14:07:45 +0000 Subject: [PATCH] fix(nvca-operator): guard missing PDB values on upgrade Helm reuse-values upgrades can omit chart defaults introduced after the original installation. Guard the PodDisruptionBudget parent map and cover the legacy values shape in both source and vendored charts. Fixes #1902 Signed-off-by: Mike Camp --- .../dev/skills/nvca-chart-release/SKILL.md | 5 ++--- .../templates/poddisruptionbudget.yaml | 2 +- .../tests/pod_disruption_budget_test.sh | 18 +++++++++++++++++- .../templates/poddisruptionbudget.yaml | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ai-tooling/dev/skills/nvca-chart-release/SKILL.md b/ai-tooling/dev/skills/nvca-chart-release/SKILL.md index dd6a573028..d1529ac40d 100644 --- a/ai-tooling/dev/skills/nvca-chart-release/SKILL.md +++ b/ai-tooling/dev/skills/nvca-chart-release/SKILL.md @@ -75,11 +75,10 @@ Propagates Helm chart changes through the native monorepo paths: Umbrella CI is declared in `tools/ci/subproject-validations.yaml` with subproject id `nvca-operator`. Do not add a chart-local `.gitlab-ci.yml`. -Validate the same chart path CI uses: +Run the repository-wide Helm validation used by CI: ```bash -tools/ci/validate-helm-chart deploy/helm/nvca-operator/nvca-operator \ - -f tools/ci/helm-validate-values/nvca-operator.yaml +tools/ci/check-helm-charts ``` ## Local Image Testing diff --git a/deploy/helm/nvca-operator/nvca-operator/templates/poddisruptionbudget.yaml b/deploy/helm/nvca-operator/nvca-operator/templates/poddisruptionbudget.yaml index 6662875aa2..10344bba7d 100644 --- a/deploy/helm/nvca-operator/nvca-operator/templates/poddisruptionbudget.yaml +++ b/deploy/helm/nvca-operator/nvca-operator/templates/poddisruptionbudget.yaml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -{{- if .Values.podDisruptionBudget.enabled }} +{{- if and .Values.podDisruptionBudget .Values.podDisruptionBudget.enabled }} {{- $pdbMinAvail := .Values.podDisruptionBudget.minAvailable | toString }} {{- $pdbMaxUnavail := .Values.podDisruptionBudget.maxUnavailable | toString }} {{- if and (ne $pdbMinAvail "") (ne $pdbMaxUnavail "") }} diff --git a/deploy/helm/nvca-operator/tests/pod_disruption_budget_test.sh b/deploy/helm/nvca-operator/tests/pod_disruption_budget_test.sh index d045bb8fd0..6d90de6410 100644 --- a/deploy/helm/nvca-operator/tests/pod_disruption_budget_test.sh +++ b/deploy/helm/nvca-operator/tests/pod_disruption_budget_test.sh @@ -28,8 +28,14 @@ assert_render_fails() { } for chart in "${source_chart}" "${vendored_chart}"; do - chart_name="$(basename "${chart}")" + if [[ "${chart}" == "${source_chart}" ]]; then + chart_name="source" + else + chart_name="vendored" + fi default_manifest="${tmp_dir}/${chart_name}-default.yaml" + reused_values_chart="${tmp_dir}/${chart_name}-reused-values" + reused_values_manifest="${tmp_dir}/${chart_name}-reused-values.yaml" min_available_manifest="${tmp_dir}/${chart_name}-min-available.yaml" max_unavailable_manifest="${tmp_dir}/${chart_name}-max-unavailable.yaml" @@ -43,6 +49,16 @@ for chart in "${source_chart}" "${vendored_chart}"; do exit 1 fi + cp -R "${chart}" "${reused_values_chart}" + yq -i 'del(.podDisruptionBudget)' "${reused_values_chart}/values.yaml" + helm template nvca-operator "${reused_values_chart}" \ + --set-string ngcConfig.serviceKey="${test_service_key}" \ + > "${reused_values_manifest}" + if grep -Fq 'kind: PodDisruptionBudget' "${reused_values_manifest}"; then + echo "expected PDB to be disabled when reused values omit its configuration for ${chart}" >&2 + exit 1 + fi + helm template nvca-operator "${chart}" \ --set-string ngcConfig.serviceKey="${test_service_key}" \ --set podDisruptionBudget.enabled=true \ diff --git a/src/compute-plane-services/nvca/deployments/nvca-operator/templates/poddisruptionbudget.yaml b/src/compute-plane-services/nvca/deployments/nvca-operator/templates/poddisruptionbudget.yaml index 6662875aa2..10344bba7d 100644 --- a/src/compute-plane-services/nvca/deployments/nvca-operator/templates/poddisruptionbudget.yaml +++ b/src/compute-plane-services/nvca/deployments/nvca-operator/templates/poddisruptionbudget.yaml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -{{- if .Values.podDisruptionBudget.enabled }} +{{- if and .Values.podDisruptionBudget .Values.podDisruptionBudget.enabled }} {{- $pdbMinAvail := .Values.podDisruptionBudget.minAvailable | toString }} {{- $pdbMaxUnavail := .Values.podDisruptionBudget.maxUnavailable | toString }} {{- if and (ne $pdbMinAvail "") (ne $pdbMaxUnavail "") }}