0

I am trying to do simple helm config using helmfile but no success. as mention here (overriding-values-from-a-parent-chart) I would like to provide one parent configuration and override release value. this is a release configmap

charts/microservice-a/templates/configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
   labels: {{- include "microservice-a.labels" . | nindent 4 }}
   name: {{ include "microservice-a.fullname" . }}-config
   namespace: {{ .Release.Namespace }}
data:
   MODEL.EN: {{ .Values.model.en }}

this is my helmfile.yaml

releases:
   - name: microservice-a
     chart: ../charts/microservice-a
     values:
       - "./environments/{{ .Environment.Name }}/values.yaml"

and this is my environments/default/values.yaml

microservice-a:
  model:
    en: "model-en-1.0.mdl"

I found that the {{ .Values.model.en }} in the configmap can not be reslove. What am I doing wrong ?

MoShe
  • 6,197
  • 17
  • 51
  • 77

1 Answers1

1

Helmfile is doing the equivalent of helm install directly; there isn't a parent-/child-chart relationship. That means your values.yaml file doesn't need the top-level microservice-a block.

If you do want a separate configuration for each service (reasonable) then you can use {{ .Release.Name }} as part of the filename. For example:

# helmfile.yaml
releases:
   - name: microservice-a
     chart: ../charts/microservice-a
     values:
       - "./environments/{{ .Environment.Name }}/values-{{ .Release.Name }}.yaml"
# environments/dev/values-microservice-a.yaml
model:
  en: "model-en-1.0.mdl"
David Maze
  • 130,717
  • 29
  • 175
  • 215
  • I was familiar with this method (using a separate file for the release) but I thought maybe there is a way to put all release configurations in the same file, I guess not. – MoShe Dec 13 '21 at 16:14
  • Having extra Helm values isn't harmful, so if only this one service uses `.Values.model` you could have a shared values file across all of your services. You can also include both `environments/{{ .Environment.Name }}/values-common.yaml` and a per-service values file, and have Helmfile ignore the per-service file if it's not present. Lots of options here. – David Maze Dec 13 '21 at 17:00