Hello group,
I'm posed with an interesting problem that I've been bumping up against for a few hours now setting the scope using a {{- with }} statement.
Given the following values.yaml snippet:
configmap:
dev:
resources:
limits:
cpu: 10m
memory: 16Mi
requests:
cpu: 5m
memory: 8Mi
alpha:
resources:
limits:
cpu: 30m
memory: 32Mi
requests:
cpu: 5m
memory: 16Mi
I'm trying to use something like the following to populate the resources block as so:
{{- $env := printf "%s" .Values.configmap.environment }}
# snip...
resources:
{{- with .Values.configmap }}.{{$env}}
{{- toYaml . | nindent 12 }}
{{- end}}
# snip...
...which renders to this:
resources:.dev
alpha:
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 20m
memory: 32Mi
dev:
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 10m
memory: 16Mi
The desired rendered yaml should actually be (when --set configmap.environment=dev is passed to helm):
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 10m
memory: 16Mi
Can someone offer any guidance on getting this kind of thing working?
Yours gratefully,
Adam D