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

template substitution for configMapKeyRef #8106

Open
liuzqt opened this issue Mar 8, 2022 · 4 comments
Open

template substitution for configMapKeyRef #8106

liuzqt opened this issue Mar 8, 2022 · 4 comments
Labels
area/templating Templating with `{{...}}` type/feature Feature request

Comments

@liuzqt
Copy link

liuzqt commented Mar 8, 2022

Summary

want to support template substitution for configMap

something like:

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: error-handling1-runner1-task
spec:
  templates:
    - name: runner1
      inputs:
        parameters:
          - name: config-map-name
          - name: img-from-config-map
            valueFrom:
              configMapKeyRef:
                name: "{{inputs.parameters.config-map-name}}"
                key: image
      container:
        image: "{{inputs.parameters.img-from-config-map}}"
        command: [sh, -c]
        args:
          [
            "echo this is runner1 {{inputs.parameters.config-map-name}} {{inputs.parameters.img-from-config-map}}",
          ]

I've tried the example above but it's not working, I suppose this feature is not supported yet. But if my usage is wrong pls let me know.

Use Cases

I might have several parallel configMap (or something like branching) and I would like to indicate the workflow which configMap to pick from


Message from the maintainers:

Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.

@liuzqt liuzqt added the type/feature Feature request label Mar 8, 2022
@alexec alexec added the area/spec Changes to the workflow specification. label Mar 9, 2022
@alexec
Copy link
Contributor

alexec commented Mar 9, 2022

This might not be possible unfortunately. The security model of the workflow controller means it typcially cannot read configmap in the user's namespace. We would not want to change this.

However, I think there is a similar issue for config maps in parameters. Did you check for that feature?

@liuzqt
Copy link
Author

liuzqt commented Mar 10, 2022

@alexec sorry but what do you mean by config maps in parameters...basically I was trying to retrieve value from configMap as one of the input parameters, but also want to "template-ize" the configMap name from another input parameter

@alexec
Copy link
Contributor

alexec commented Mar 10, 2022

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: arguments-parameters-from-configmap-
  labels:
    workflows.argoproj.io/test: "true"
  annotations:
    workflows.argoproj.io/description: |
      This example demonstrates loading parameter values from configmap.
      Note that the "simple-parameters" ConfigMap (defined in examples/configmaps/simple-parameters-configmap.yaml)
      needs to be created first before submitting this workflow.
spec:
  entrypoint: whalesay
  templates:
  - name: whalesay
    inputs:
      parameters:
      # Parameters can also be passed via configmap reference.
      - name: message
        valueFrom:
          configMapKeyRef:
            name: simple-parameters
            key: msg
    container:
      image: argoproj/argosay:v2
      args: ["echo", "{{inputs.parameters.message}}"]

@liuzqt
Copy link
Author

liuzqt commented Mar 10, 2022

@alexec that's what I'm using for now, and I want to do further template substitution like

      parameters:
      # Parameters can also be passed via configmap reference.
      - name: config-map-name
      - name: message
        valueFrom:
          configMapKeyRef:
            name: {{inputs.parameters.config-map-name}}
            key: msg

but I guess that's not easy to do......I'll try to find some other workaround

@agilgur5 agilgur5 added area/templating Templating with `{{...}}` and removed area/spec Changes to the workflow specification. labels Oct 16, 2024
@agilgur5 agilgur5 changed the title template substitution for configMap template substitution for configMapKeyRef Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/templating Templating with `{{...}}` type/feature Feature request
Projects
None yet
Development

No branches or pull requests

3 participants