I am trying build a base helm template for all my services which includes variables and secrets passing through configMaps from Values.yml like the following out of which some files are optional for few service but always '-configmap' '-secret' is followed :
configmaps:
- common-configmap
- <service-name>-configmap (optional)
- common-secret
- <service-name>-secret (optional)
- others-configmap
- others-secret
How do I write a condition in my template _deployment.yml to include above based on the name, if it has configmap it should go under configMapRef
or else under secretRef
like
envFrom: {{- range .Values.configMaps }} <Condition in name> - configMapRef: name: {{ . }} <else Condition> - secretRef: name: {{ . }} {{- end }}