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

default not respected in configMapKeyRef when used to set global parameters #9745

Closed
2 of 3 tasks
phlax opened this issue Oct 4, 2022 · 2 comments · Fixed by #9758
Closed
2 of 3 tasks

default not respected in configMapKeyRef when used to set global parameters #9745

phlax opened this issue Oct 4, 2022 · 2 comments · Fixed by #9758
Labels

Comments

@phlax
Copy link

phlax commented Oct 4, 2022

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?

Allowing a default value for a ConfigMapKeyRef was added in #8271 (ref #8262)

It does not appear that this works for global workflow parameters

if param.ValueFrom != nil && param.ValueFrom.ConfigMapKeyRef != nil {
cmValue, err := common.GetConfigMapValue(woc.controller.configMapInformer, woc.wf.ObjectMeta.Namespace, param.ValueFrom.ConfigMapKeyRef.Name, param.ValueFrom.ConfigMapKeyRef.Key)
if err != nil {
return fmt.Errorf("failed to set global parameter %s from configmap with name %s and key %s: %w",
param.Name, param.ValueFrom.ConfigMapKeyRef.Name, param.ValueFrom.ConfigMapKeyRef.Key, err)
}
woc.globalParams["workflow.parameters."+param.Name] = cmValue

Version

latest

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.

apiVersion: argoproj.io/v1alpha1
kind: Workflow                                                                                                                                                                
metadata:                                                                                                                                                                     
  generateName: global-cm-param-default-                                                                                                                           
spec:                                                                                                                                                                         
  entrypoint: main                                                                                                                                                            
  arguments:                                                                                                                                                                  
    parameters:                                                                                                                                                                                                                                                                                                              
    - name: param-that-wants-a-default                                                                                                                                                        
      valueFrom:                                                                                                                                                              
        default: ""                                                                                                                                                           
        configMapKeyRef:                                                                                                                                                      
          name: "some-config-map"                                                                                                                           
          key: maybe-existing-key                                                                                                                                                     

      workflowTemplateRef:                                                                                                                                                        
        name: some-wf-template

Logs from the workflow controller

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

N/A

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

N/A

@phlax phlax added the type/bug label Oct 4, 2022
@phlax phlax changed the title default not respected in ConfigKeyMapRef when used to set global parameters default not respected in ConfigMapKeyRef when used to set global parameters Oct 4, 2022
@phlax phlax changed the title default not respected in ConfigMapKeyRef when used to set global parameters default not respected in configMapKeyRef when used to set global parameters Oct 4, 2022
@sarabala1979
Copy link
Member

@phlax Do you like to fix this issue?

@phlax
Copy link
Author

phlax commented Oct 4, 2022

i would like to but my go-fu is weak so probably im not best placed to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants