'helm range exclude #values

I am trying to generate a ConfigMap by reading from env.config from the Helm values file and it's working as expected. However, I need to exclude the value starting with # in the below function from the values file under env.config.

Is any method to achieve this?

data:
{{- range $key, $val := .Values.env.config }}
{{ $key }}: {{ $val | quote }}
{{- end}}

values file:

 env:
  config:
   value1: valueone
   value2: valuetwo
   #value3: valuethree
   value4: valuefour

Here value3 should be ignored while generating the ConfigMap.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source