multiple deployments
Hi, i need to create multiple deployments in cycle. But it doesn't work, because yaml structure of deployment doesn't accept array of deployments.
Is there any way to create multiple deployments without creating multiple files and copy/paste data?
You can put multiple YAML documents in one file by separating them with --- on its own line. See for example here: https://github.com/sapcc/helm-charts/blob/master/openstack/limes/templates/collect-deployment.yaml - This loops over a map inside .Values to create multiple Deployments. The second-to-last line is --- which separates the individual Deployments rendered by each loop iteration.
Hi, can I get a copy of your values.yaml. I would like to have a look at .Values.limes.clusters
I have something like this in values.yaml replicaCount: 1 maasappname: consumer maasappaliasname: message-consumer instance_names: a: 1 b: 2 And I have deploymentconfig like below - {{ range $key, $value := .Values.instance_names }} kind: "DeploymentConfig" apiVersion: "apps.openshift.io/v1" metadata: name: "maas-{{$key}}" labels: apptype: batch spec: template: metadata: labels: app: "{{ .Values.maasappname }}"
When I run helm install. I get this error - Error: template: maas360/charts/consumer/templates/dc-collect.yaml:12:24: executing "maas360/charts/consumer/templates/dc-collect.yaml" at <.Values.maasappname>: can't evaluate field Values in type interface {} Could you pls help
@himmakam when iterating data by range, the context is switched to particular element from .Values.instance_names, so actually in range you are trying to access .Values.instance_names.$key.Values.maasappname.
Try to set .Values.maasappname to variable before range:
{{ $appName := .Values.maasappname }}
Then use variable in range:
app: "{{ $appName }}"
i have a post on my website about GO templates syntax, maybe it also helps https://golangforall.com/en/post/templates.html
Inside the range, . refers to the loop variable, i.e. $value. The error is that $value does not have a Values key. To access the global .Values, you can write $.Values.
ok. thanks a lot.