Argo: WorkflowTemplate parameters are not substituted when referenced

Created on 4 Sep 2019  路  3Comments  路  Source: argoproj/argo

Is this a BUG REPORT or FEATURE REQUEST?:
BUG REPORT

What happened:
Even though WorkflowTemplate.spec.arguments.parameters are allowed as far as validation and API is concerned, those parameters are not substituted unless the workflow which includes the template (templateRef) provides them itself.

Consider the following scenario:

kind: WorkflowTemplate
metadata:
  name: sample
  generateName: step-
  labels:
    mark: cleanup
spec:
  entrypoint: main
  arguments:
    parameters:
      - name: cpu
        value: "500m"
      - name: memory
        value: "1Gi"

and a workflow which references that template

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  # name: inspection-batch
  generateName: job-
spec:
  entrypoint: main
  templates:
  - name: main
    steps:
    - - name: run
        templateRef:
          name: inspection-run
          template: main

The resulting manifest stored in workflows.argoproj.io/template contains cpu: \"{{workflow.parameters.cpu}}\", hence was not properly substituted.

I assume the current workflow becomes the context of the template, however, I would NOT expect such behavior.

What you expected to happen:
I expect that unless I explicitly provide the workflow arguments in the target Workflow, the arguments defined in WorkflowTemplate are used.

Environment:

  • Argo version:
$ argo version

argo: v2.4.0-rc1
  BuildDate: 2019-08-08T22:59:15Z
  GitCommit: 6131721f43545196399d7ffe3a72c1b9dc04df87
  GitTreeState: clean
  GitTag: v2.4.0-rc1
  GoVersion: go1.11.5
  Compiler: gc
  Platform: linux/amd64
  • Kubernetes version :
$ kubectl version -o yaml

clientVersion:
  buildDate: 2018-10-10T16:38:01Z
  compiler: gc
  gitCommit: d4cacc0
  gitTreeState: clean
  gitVersion: v1.11.0+d4cacc0
  goVersion: go1.10.3
  major: "1"
  minor: 11+
  platform: linux/amd64
serverVersion:
  buildDate: 2019-08-30T20:25:39Z
  compiler: gc
  gitCommit: d4cacc0
  gitTreeState: clean
  gitVersion: v1.11.0+d4cacc0
  goVersion: go1.10.8
  major: "1"
  minor: 11+
  platform: linux/amd64
wontfix

Most helpful comment

This is an interesting idea. Let me check if it鈥檚 easy to implement in the current template resolution logic.

All 3 comments

This is an interesting idea. Let me check if it鈥檚 easy to implement in the current template resolution logic.

Hello! Any updates on this?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings