2

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?

3

Kustomize offers a way to "hint" where to find image tags.

Add a file called kustomconfig.yaml:

images:
- path: spec/workflowSpec/templates[]/container/image
  kind: WorkflowTemplate

Add the following to your kustomization.yaml:

configurations:
- kustomconfig.yaml

You're done. The images transformer will pick up those fields.

3
  • 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? – Vektor88 Jun 4 at 20:00
  • 1
    @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? – Michael Crenshaw Jun 4 at 20:39
  • 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: argoproj.github.io/argo-rollouts/features/kustomize – Vektor88 Jun 5 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.