Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valueFrom not allowed for argument parameters in dag templates (but in steps) #11900

Closed
3 tasks done
nice-pink opened this issue Sep 29, 2023 · 1 comment · Fixed by #11902
Closed
3 tasks done

valueFrom not allowed for argument parameters in dag templates (but in steps) #11900

nice-pink opened this issue Sep 29, 2023 · 1 comment · Fixed by #11902
Labels
area/looping `withParams`, `withItems`, and `withSequence` area/templates/dag P3 Low priority type/bug

Comments

@nice-pink
Copy link
Contributor

nice-pink commented Sep 29, 2023

Pre-requisites

  • I have double-checked my configuration
  • I can confirm the issues exists when I tested with :latest
  • I'd like to contribute the fix myself (see contributing guide)

What happened/what you expected to happen?

arguments:
  parameters:
  - name: param
    valueFrom:
      configMapKeyRef:
        name: my-config
        key: param

throws the error when submitting in dag template but works for steps.

Error is:

{"code":3,"message":"templates.main.tasks.print missing value for parameter 'param'"}: templates.main.tasks.print missing value for parameter 'param'

Below are the entire workflows.

Version

v3.4.11

Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

Throws an error:

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: value-from-fail
spec:
  entrypoint: main
  templates:
  - name: main
    dag:
      tasks:
      - name: print
        template: print-param
        arguments:
          parameters:
          - name: param
            valueFrom:
              configMapKeyRef:
                name: cm-param-test-ping
                key: param

  - name: print-param
    inputs:
      parameters:
      - name: param
    container:
      image: cgr.dev/chainguard/bash:latest
      command:
      - /bin/bash
      - -c
      - |
        set -eu
        echo "{{inputs.parameters.param}}"

Works as expected:

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: value-from-success
spec:
  entrypoint: main
  templates:
  - name: main
    steps:
    - - name: print
        template: print-param
        arguments:
          parameters:
          - name: param
            valueFrom:
              configMapKeyRef:
                name: cm-param-test-ping
                key: param
  - name: print-param
    inputs:
      parameters:
      - name: param
    container:
      image: cgr.dev/chainguard/bash:latest
      command:
      - /bin/bash
      - -c
      - |
        set -eu
        echo "{{inputs.parameters.param}}"

Config map:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cm-param-test-ping
  labels:
    # Note that this label is required for the informer to detect this ConfigMap.
    workflows.argoproj.io/configmap-type: Parameter
data:
  param: ping

Logs from the workflow controller

kubectl logs -n argo deploy/workflow-controller | grep ${workflow}

Logs from in your workflow's wait container

kubectl logs -n argo -c wait -l workflows.argoproj.io/workflow=${workflow},workflow.argoproj.io/phase!=Succeeded
@nice-pink
Copy link
Contributor Author

nice-pink commented Sep 29, 2023

In validate_dab_test.go it looks like the behaviour is intended. I guess to avoid empty parameters. But I think my example from above shows that there are use cases were using valueFrom instead of value makes sense.

Or is there a reason, I don't see, why this works with steps but not with dag?

@agilgur5 agilgur5 added area/looping `withParams`, `withItems`, and `withSequence` area/templates/dag P3 Low priority labels Sep 30, 2023
@nice-pink nice-pink changed the title Combination valueFrom and withParam does not work for dag templates valueFrom not allowed for argument parameters in dag templates (but in steps) Oct 5, 2023
juliev0 pushed a commit that referenced this issue Feb 5, 2024
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue Feb 20, 2024
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue Feb 27, 2024
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue Feb 28, 2024
argoproj#11902)

Signed-off-by: nice-pink <r@nice.pink>
Signed-off-by: Isitha Subasinghe <isubasinghe@student.unimelb.edu.au>
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue Mar 12, 2024
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue May 6, 2024
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/looping `withParams`, `withItems`, and `withSequence` area/templates/dag P3 Low priority type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants