Search code examples
argo-workflows

Argo workflow json parameter file and secrets


Argo workflows allows you to specify arguments in a json file:

{
  "valueA": 1,
  "valueB": 2,
  "valueC": 3,
  "valueD": 4
}

and then specify this when the workflow is submitted:

argo submit workflow.yaml -f params.json --watch

I have a workflow manifest that has multiple steps which use the same secret, is there anyway of specifying secrets in the json parameter file ?, to provide more context I'm using things such as aws secrets and keys:

- name: AWS_ACCESS_KEY_ID
  valueFrom:
    secretKeyRef:
      name: aws-access-key-id
      key: awsaccesskeyid

Other than to plug parameters into this:

- name: AWS_ACCESS_KEY_ID
      valueFrom:
        secretKeyRef:
          name: "{{ workflow.parameters . . . }}"
          key: "{{ workflow.parameters . . . }}"

Is there a more elegant way to parameterize this ?


Solution

  • I would create a secret from the json file as explained here.

    Then you can just use that secret using secretRef, this eliminates the need to specify each and every value. The "downside" is that you'll need to create/clean secrets from your cluster, managing naming conflicts etc.

    envFrom:
      - secretRef:
          name: secret-name
    

    You can also use a ConfigMap instead if you want to only use "argo" variables.