【发布时间】:2021-06-25 15:37:50
【问题描述】:
我有一个通过 Argo Events 和 PubSub 触发的 WorkflowTemplate “nyc-test-template”。因此,如果我将消息 {} 发布到 PubSub 主题“argo-events-nyc”中,则会启动通过 workflowTempateRef 指定的模板。这确实工作得很好。现在我想参数化要启动的模板。
我的不工作草稿如下:
apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
name: pubsub-event-source-nyc
spec:
template:
serviceAccountName: argo-events
pubSub:
examplex:
jsonBody: true
topic: argo-events-nyc
subscriptionID: argo-events-nyc-sub
---
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: pubsub-sensor-nyc
spec:
template:
serviceAccountName: argo-events-sa
dependencies:
- name: pubsub-event-source-dep
eventSourceName: pubsub-event-source-nyc
eventName: examplex
triggers:
- template:
name: argo-workflow-trigger
argoWorkflow:
group: argoproj.io
version: v1alpha1
resource: workflows
operation: submit
source:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: nyc-test-template-
namespace: argo
spec:
arguments:
parameters:
- name: wft
value: nyc-test-template
workflowTemplateRef:
# I'm pretty sure this inputs block is useless. But leaving it out
# and instead referencing arguments.parameters.wft won't work either.
inputs:
parameters:
- name: wft
name: "{{inputs.parameters.wft}}"
parameters:
- src:
dependencyName: pubsub-event-source-dep
dataKey: body.wft
dest: spec.arguments.parameters.0.value
我希望发生的事情是这样的:
- 空消息
{}将触发“nyc-test-template” - 消息
{"wft": "my-template"}将触发“我的模板”
而不是发布空消息会导致传感器抛出错误:
2021-03-29T15:31:16.386441528Z2021/03/29 15:31:16 Failed to parse workflow: error unmarshaling JSON: while decoding JSON: json: unknown field "inputs"
坦率地说 - 以上 yaml 的粗略灵感来自 this example。这并不是有根据的猜测的结果,因为我仍然不了解参数、参数和输入如何交互的机制。
【问题讨论】:
标签: argoproj argo-events