<p>I have a list of docker images which I want to pass as an environment variable to deployment.yaml</p>
<p><code>values.yaml</code></p>
<pre><code>contributions_list:
  - image: flogo-aws
    tag: 36
  - image: flogo-awsec2
    tag: 37
  - image: flogo-awskinesis
    tag: 18
  - image: flogo-chargify
    tag: 19
</code></pre>
<p><code>deployment.yaml</code></p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: container-image-extractor
  namespace: local-tibco-tci
  labels:
    app.cloud.tibco.com/name: container-image-extractor
spec:
  backoffLimit: 0
  template:
    metadata:
      labels:
        app.cloud.tibco.com/name: container-image-extractor
    spec:
      nodeSelector:
        kubernetes.io/os: linux
      restartPolicy: Never
      containers:
      - name: container-image-extractor
        image: reldocker.tibco.com/stratosphere/container-image-extractor
        imagePullPolicy: IfNotPresent
        env:
        - name: SOURCE_DOCKER_IMAGE
          value: &quot;&lt;docker_image&gt;:&lt;docker_tag&gt;&quot;    # docker image from which contents to be copied
 
</code></pre>
<p>My questions are as follows.</p>
<ol>
<li>Is this the correct way to pass an array of docker image and tags as an argument to deployment.yaml</li>
<li>How would I replace &lt;docker_image&gt; and &lt;docker_tag&gt; in deployment.yaml from values.yaml and incrementally job should be triggered for each docker image and tag.</li>
</ol>

Rajiv Rai
<p>This is how I would do it, creating a job for every image in your list</p>
<pre><code>{{- range .Values.contributions_list }}
apiVersion: batch/v1
kind: Job
metadata:
  name: &quot;container-image-extractor-{{ .image }}-{{ .tag }}&quot;
  namespace: local-tibco-tci
  labels:
    app.cloud.tibco.com/name: container-image-extractor
spec:
  backoffLimit: 0
  template:
    metadata:
      labels:
        app.cloud.tibco.com/name: container-image-extractor
    spec:
      nodeSelector:
        kubernetes.io/os: linux
      restartPolicy: Never
      containers:
      - name: container-image-extractor
        image: reldocker.tibco.com/stratosphere/container-image-extractor
        imagePullPolicy: IfNotPresent
        env:
        - name: SOURCE_DOCKER_IMAGE
          value: &quot;{{ .image }}:{{ .tag }}&quot;    # docker image from which contents to be copied
{{ end }}

</code></pre>
<p>If you use a value outside of this contribution list (release name, env, whatever), do not forget to change the scope such         <code>{{ $.Values.myjob.limits.cpu | quote }}</code>. The <code>$.</code> is important :)</p>
<p><em>Edit: If you don't change the name at each iteration of the loop, it will override the configuration every time. With different names, you will have multiple jobs created.</em></p>
