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

arguments.parameters.value can be referenced as local variable but arguments.parameters.valueFrom.configMapKeyRef can be referenced only as global variable #6869

Closed
apiwoni opened this issue Oct 6, 2021 · 4 comments
Assignees
Labels

Comments

@apiwoni
Copy link

apiwoni commented Oct 6, 2021

Summary

arguments.parameters.value can be referenced as a local variable using {{input.parameters.param-name}} but arguments.parameters.valueFrom.configMapKeyRef can be referenced only as global variable {{workflow.parameters.param-name}}. This is inconsistent behavior!

Issue #3212 was fixed by allowing valueFrom.configMapKeyRef

What happened/what you expected to happen?

I should be able to access variable declared using arguments.parameters.valueFrom.configMapKeyRef as {{input.parameters.param-name}} same as for variable declared as arguments.parameters.value

What version of Argo Workflows are you running?
argo: v3.2.0-rc5

Diagnostics

Either a workflow that reproduces the bug, or paste you whole workflow YAML, including status, something like:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: arguments-parameters-from-configmap-
spec:
  entrypoint: whalesay
  arguments:
    parameters:
    - name: message
#      value: "can be accessed as inputs.parameters.message"
#     Can only be accessed as global variable workflow.parameters.message but not as local variable inputs.parameters.message        
      valueFrom:
        configMapKeyRef:
          name: simple-parameters
          key: msg
  templates:
    - name: whalesay
      inputs:
        parameters:
          - name: message
#            Workaround to access valueFrom.configMapKeyRef as local variable        
#            value: "{{workflow.parameters.message}}"  
      container:
        image: docker/whalesay:latest
        command: [cowsay]
        args: ["{{inputs.parameters.message}}"]

ConfigMap same as https://github.com/argoproj/argo-workflows/blob/v3.2.0-rc5/examples/configmaps/simple-parameters-configmap.yaml

argo submit arguments-parameters-from-configmap.yaml
FATA[2021-10-05T17:47:49.367Z] Failed to submit workflow: templates.whalesay inputs.parameters.message was not supplied 

When I replace arguments.parameters.valueFrom with arguments.parameters.value it works


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

@terrytangyuan
Copy link
Member

Could you try this example? This example uses local variables as well. https://github.com/argoproj/argo-workflows/blob/master/examples/arguments-parameters-from-configmap.yaml

@apiwoni
Copy link
Author

apiwoni commented Oct 6, 2021

@terrytangyuan I already tried above workflow and this one works as expected

@terrytangyuan
Copy link
Member

terrytangyuan commented Oct 7, 2021

Thanks, I was able to reproduce.

It seems like this case is not supported yet: local parameters defined in spec.arguments.parameters using configMapKeyRef cannot be referenced by {{inputs.parameters.xxx}} in templates. The existing examples do work though.

In other words, the following should work but it doesn't:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: arguments-parameters-from-configmap-
spec:
  entrypoint: whalesay
  serviceAccountName: argo
  arguments:
    parameters:
    - name: message
      valueFrom:
        configMapKeyRef:
          name: simple-parameters
          key: msg
  templates:
    - name: whalesay
      inputs:
        parameters:
          - name: message
      container:
        image: docker/whalesay:latest
        command: [cowsay]
        args: ["{{inputs.parameters.message}}"]

I can look into this when I get a chance but in the meantime would you or anyone else watching this issue like to submit a PR to fix this?

@terrytangyuan terrytangyuan added good first issue Good for newcomers and removed triage labels Oct 8, 2021
@smile-luobin
Copy link
Contributor

smile-luobin commented Oct 9, 2021

Thanks, I was able to reproduce.

It seems like this case is not supported yet: local parameters defined in spec.arguments.parameters using configMapKeyRef cannot be referenced by {{inputs.parameters.xxx}} in templates. The existing examples do work though.

In other words, the following should work but it doesn't:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: arguments-parameters-from-configmap-
spec:
  entrypoint: whalesay
  serviceAccountName: argo
  arguments:
    parameters:
    - name: message
      valueFrom:
        configMapKeyRef:
          name: simple-parameters
          key: msg
  templates:
    - name: whalesay
      inputs:
        parameters:
          - name: message
      container:
        image: docker/whalesay:latest
        command: [cowsay]
        args: ["{{inputs.parameters.message}}"]

I can look into this when I get a chance but in the meantime would you or anyone else watching this issue like to submit a PR to fix this?

I am trying to fix this bug. PR: #6898

@sarabala1979 sarabala1979 mentioned this issue Oct 21, 2021
24 tasks
kriti-sc pushed a commit to kriti-sc/argo-workflows that referenced this issue Oct 24, 2021
…ariable. Fixes argoproj#6869 (argoproj#6898)

Signed-off-by: kriti-sc <kathuriakriti1@gmail.com>
@sarabala1979 sarabala1979 mentioned this issue Nov 9, 2021
25 tasks
@sarabala1979 sarabala1979 mentioned this issue Dec 15, 2021
73 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants