Answers: <p>Kustomize <a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/transformerconfigs/images/README.md" rel="nofollow noreferrer">offers a way to &quot;hint&quot;</a> where to find image tags.</p>
  <p>Add a file called <code>kustomconfig.yaml</code>:</p>
  <pre class="lang-yaml prettyprint-override"><code>images:
  - path: spec/templates[]/container/image
    kind: WorkflowTemplate
  - path: spec/templates[]/script/image
    kind: WorkflowTemplate
  </code></pre>
  <p>Add the following to your kustomization.yaml:</p>
  <pre class="lang-yaml prettyprint-override"><code>configurations:
  - kustomconfig.yaml
  </code></pre>
  <p>You're done. The images transformer will pick up those fields.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-06-04T20:00:24.877Z
Answers: Thanks for the answer, this solves my issue! Since I'm new to this ecosystem I'll dare to ask a curiosity, wouldn't it be better if Argo team would provide kustomize transformer configurations? What's the reason behind everyone having to implement their own versions, since the structure of a workflow is well known?
Answers: Vektor88
Answers: CC BY-SA 4.0
Answers: 2021-06-04T20:39:08.353Z
Answers: @Vektor88 good question. When you say "provide kustomize transformer configurations," do you mean add this answer to the docs somewhere, or actually contribute code to kustomize or some kind of plugin to support image transformations for Argo's CRDs?
Answers: crenshaw-dev
Answers: CC BY-SA 4.0
Answers: 2021-06-05T06:18:47.773Z
Answers: I would say that a good first step might be providing them in the "Kustomize" section of the documentation, similarly to what's been done for argo rollouts: https://argoproj.github.io/argo-rollouts/features/kustomize/
Answers: Vektor88
Answers: CC BY-SA 4.0
Answers: 2021-06-04T19:51:23.273Z
Answers: 2022-08-24T19:06:55.247Z
Answers: 2022-08-24T19:06:55.247Z
Answers: crenshaw-dev
Body: <p>I am developing an ETL pipeline using Argo Workflows, and in order to handle environment related configurations, I am using Kustomize.</p>
  <p>Here is the base/cronworkflow.yaml file</p>
  <pre><code>apiVersion: argoproj.io/v1alpha1
  kind: CronWorkflow
  metadata:
    name: cronworkflow
  spec:
    concurrencyPolicy: Forbid
    failedJobsHistoryLimit: 3
    successfulJobsHistoryLimit: 3
    startingDeadlineSeconds: 300
    workflowSpec:
      entrypoint: start
      templates:
      - name: start
        container:
          name: my-start-task
          image: app-image
          command:
            - /bin/sh
            - -xec
            - |
              ./entrypoint.sh
          env:
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: aws-creds
                  key: access-key
  </code></pre>
  <p>Kustomize doesn't seem to work well when using <code>patchesStrategicMerge</code>, because it can only deal (out of the box at least) only with standard k8s kinds. With 3rd party kinds, it will simply overwrite the entire tree structure instead of trying to merge.</p>
  <p>I had to use <code>patchesJson6902</code> on the yaml file defining my Argo <code>CronWorkflow</code>, but now the <code>images</code> transformer doesn't seem to work anymore.</p>
  <p>Am I missing something? Is there a convenient way to fix the behavior of <code>patchesStrategicMerge</code>? Are argo workflows &quot;type definitions&quot; for Kustomize available somewhere?</p>
  
Tags: <kubernetes><workflow><kustomize>
Title: Use a Kustomize image transformation on an Argo CronWorkflow
UserDisplayName: Vektor88
ThreadText: # Use a Kustomize image transformation on an Argo CronWorkflow
  
  (Asked by: username_0 on 2021-06-04)
  
  I am developing an ETL pipeline using Argo Workflows, and in order to handle environment related configurations, I am using Kustomize.
  
  Here is the base/cronworkflow.yaml file
  
  ```
  apiVersion: argoproj.io/v1alpha1
  kind: CronWorkflow
  metadata:
    name: cronworkflow
  spec:
    concurrencyPolicy: Forbid
    failedJobsHistoryLimit: 3
    successfulJobsHistoryLimit: 3
    startingDeadlineSeconds: 300
    workflowSpec:
      entrypoint: start
      templates:
      - name: start
        container:
          name: my-start-task
          image: app-image
          command:
            - /bin/sh
            - -xec
            - |
              ./entrypoint.sh
          env:
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: aws-creds
                  key: access-key
  
  ```
  
  Kustomize doesn't seem to work well when using `patchesStrategicMerge`, because it can only deal (out of the box at least) only with standard k8s kinds. With 3rd party kinds, it will simply overwrite the entire tree structure instead of trying to merge.
  
  I had to use `patchesJson6902` on the yaml file defining my Argo `CronWorkflow`, but now the `images` transformer doesn't seem to work anymore.
  
  Am I missing something? Is there a convenient way to fix the behavior of `patchesStrategicMerge`? Are argo workflows "type definitions" for Kustomize available somewhere?
  
  **Tags:** kubernetes, workflow, kustomize
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-06-04. Score: 8 | Accepted answer
  
  Kustomize [offers a way to "hint"](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/transformerconfigs/images/README.md) where to find image tags.
  
  Add a file called `kustomconfig.yaml`:
  
  ```yaml
  images:
  - path: spec/templates[]/container/image
    kind: WorkflowTemplate
  - path: spec/templates[]/script/image
    kind: WorkflowTemplate
  
  ```
  
  Add the following to your kustomization.yaml:
  
  ```yaml
  configurations:
  - kustomconfig.yaml
  
  ```
  
  You're done. The images transformer will pick up those fields.
  
  > **Comments:**
  > **username_0**: Thanks for the answer, this solves my issue! Since I'm new to this ecosystem I'll dare to ask a curiosity, wouldn't it be better if Argo team would provide kustomize transformer configurations? What's the reason behind everyone having to implement their own versions, since the structure of a workflow is well known?  
  > **username_1**: @username_0 good question. When you say "provide kustomize transformer configurations," do you mean add this answer to the docs somewhere, or actually contribute code to kustomize or some kind of plugin to support image transformations for Argo's CRDs?  
  > **username_0**: I would say that a good first step might be providing them in the "Kustomize" section of the documentation, similarly to what's been done for argo rollouts: https://argoproj.github.io/argo-rollouts/features/kustomize/  
  
  ---
  
  