0
votes

i want to pass two arguments to the to "deployment template" from the values.yaml the result should be like this : enter image description here

in values.yaml i have this >>> enter image description here

And here is my template deployment file :

{{ if .Values.containerCommand }}
      command: [{{ .Values.containerCommand }}] 
{{ end }}

The questions is how can i pass two arguments to "containerCommand" value.

Because when i want to these arguments to the helm, i got an error:

I got an error Error: UPGRADE FAILED: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].command[0]): invalid type for io.k8s.api.core.v1.Container.command: got "array", expected "string"

1

1 Answers

2
votes

You can iterate through the collection using range operator, like following


{{ if .Values.containerCommand }}
      command: {{- range .Values.containerCommand }}
        - {{ . }} {{- end}}
{{- end}}

To learn details check here