I have a simple values.yml file for my Helm chart:
DbMigration:
Resources:
requests:
memory: 256Mi
limits:
memory: 512Mi
In a definition for my database migration job, I have this:
spec:
activeDeadlineSeconds: 120
template:
spec:
restartPolicy: Never
containers:
- name: myMigrate
image: myRepo/myService:0.0.1
imagePullPolicy: Always
resources:
requests:
{{- range $key, $value := $.Values.DbMigration.Resources.requests }}
{{ $key }}: {{ $value }}
{{- end }}
limits:
{{- range $key, $value := $.Values.DbMigration.Resources.limits }}
{{ $key }}: {{ $value }}
{{- end }}
Is is there any way to simplify the resources area so that I can just include all the data from $.Values.DbMigration.Resources? What I have works, but there must be a more concise way. I tried using the toYaml function in a fashion similar to this:
{{- toYaml $.Values.DbMigration.Resources }}
However, that results in:
Error: UPGRADE FAILED: YAML parse error on myTemplate.yaml: error converting YAML to JSON: yaml: line 30: mapping values are not allowed in this context