diff --git a/library/common/templates/lib/pod/volumes/_configmap.tpl b/library/common/templates/lib/pod/volumes/_configmap.tpl index a7a73900..33370168 100644 --- a/library/common/templates/lib/pod/volumes/_configmap.tpl +++ b/library/common/templates/lib/pod/volumes/_configmap.tpl @@ -20,7 +20,7 @@ objectData: The object data to be used to render the volume. {{- if $expandName -}} {{- $object := (get $rootCtx.Values.configmap $objectName) -}} - {{- if not $object -}} + {{- if and ( not $object ) ( not $objectData.optional ) -}} {{- fail (printf "Persistence - Expected configmap [%s] defined in to exist" $objectName) -}} {{- end -}} @@ -46,6 +46,9 @@ objectData: The object data to be used to render the volume. {{- with $defMode }} defaultMode: {{ . }} {{- end -}} + {{- if $objectData.optional }} + optional: true + {{- end -}} {{- with $objectData.items }} items: {{- range . -}}