From 728f55fff3ebf02776e8d984366ffa585b22b091 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 11 Nov 2024 16:32:11 -0500 Subject: [PATCH] bugfix: proper handling of values set to 0 `if .Values.X` evaluates to false if X is defined to be 0. This resulted in retryLimit and terminationGracePeriodSeconds not being properly propagated through the the generated yaml if the user sets their value to 0 (as opposed to nil). --- tools/pytorchjob-generator/chart/templates/_helpers.tpl | 2 +- tools/pytorchjob-generator/chart/templates/appwrapper.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/pytorchjob-generator/chart/templates/_helpers.tpl b/tools/pytorchjob-generator/chart/templates/_helpers.tpl index d4aa42e..f4e4fd4 100644 --- a/tools/pytorchjob-generator/chart/templates/_helpers.tpl +++ b/tools/pytorchjob-generator/chart/templates/_helpers.tpl @@ -29,7 +29,7 @@ annotations: {{- define "mlbatch.schedulingSpec" }} -{{- if .Values.terminationGracePeriodSeconds }} +{{- if ne .Values.terminationGracePeriodSeconds nil }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} {{- end }} {{- if .Values.bypassCoscheduler }} diff --git a/tools/pytorchjob-generator/chart/templates/appwrapper.yaml b/tools/pytorchjob-generator/chart/templates/appwrapper.yaml index 91420fc..6b8543c 100644 --- a/tools/pytorchjob-generator/chart/templates/appwrapper.yaml +++ b/tools/pytorchjob-generator/chart/templates/appwrapper.yaml @@ -67,7 +67,7 @@ metadata: {{- if .Values.retryPausePeriodDuration }} workload.codeflare.dev.appwrapper/retryPausePeriodDuration: "{{ .Values.retryPausePeriodDuration }}" {{- end }} - {{- if .Values.retryLimit }} + {{- if ne .Values.retryLimit nil }} workload.codeflare.dev.appwrapper/retryLimit: "{{ .Values.retryLimit }}" {{- end }} {{- if .Values.forcefulDeletionGracePeriodDuration }}