我正在尝试读取ConfigMap中存储为Json的URL列表,然后将这些URL作为参数传递给Argo工作流的下一步。
我的配置图如下:
apiVersion: v1
kind: ConfigMap
metadata:
name: urls
data:
urls: |
[
{"url": "https://www.google.com/"},
{"url": "https://stackoverflow.com/"}
]
我的工作流程模板如下(为简洁起见,省略了元数据(:
templates:
- name: main
dag:
tasks:
- name: get-urls
template: urls
- name: url-thingy
dependencies: ['get-urls']
templateRef:
name: do-thing-with-the-urls
template: url-thing
arguments:
parameters:
- name: url
value: "{{ item.url }}"
withParam: "{{tasks['get-urls'].outputs.result}}"
- name: urls
resource:
action: get
manifest: |
apiVersion: v1
kind: ConfigMap
metadata:
name: urls
outputs:
parameters:
- name: urls
valueFrom:
jsonPath: '{.data.urls}'
这加载了ConfigMap文件,我可以在get-urls
步骤的输出下看到列出的url。当它试图执行url-thingy
步骤时,失败并显示消息:
withParam value could not be parsed as a JSON list: {{tasks['get-urls'].outputs.result}}: invalid character '{' looking for beginning of object key string
我觉得我已经接近解决方案了,但我不确定哪里出了问题?使用Param访问我的列表是否正确?
尝试{{=toJson(tasks['get-urls'].outputs.result)}}