I am using argo to orchestrate my workflow. One of the many python tasks that I have accepts nargs as a param, and I am trying to figure out how I can pass the +nargs from a config map.
For each workflow job I plan to have a different configMap, where the narg param could vary.
For example one of the jobs could have market_app.py --buy_fruits apple pear
other could have market_app.py --buy_fruits blueberry raspberry strawberry
When my argo yaml is trying to read this from config map its gets read as one string and not many string passed into the value of the config key and it doesnt load it as a list what is usually handled by default when passed from command line.
This is how my configMap key/value pair looks :
buy_fruits: apple pear
and my deployment yaml would have
- name: go-to-market
container:
args:
- '--buy_fruits'
- '{{inputs.parameter.fruits}}'
command:
["python",'-m',"market_app"]
inputs:
parameters:
- name: fruits
valueFrom:
configMapKeyRef:
name: market-config
key: buy_fruits
When my app starts it should load the config as ["apple","pear"] whereas with the above example its loading as ["apple pear"]
I could definitely change how my app reads it but I am refraining from changing my code just to make it read from configMap.
If you are passing the value in
args
. Each element in the arg list will be considered as asingle string
. We can overcome this behaviour by avoidingargs
. I used the below python script for validation.test.py
deployment.yaml
ConfigMap
Pod logs