0

我有两个工作流模板(T1,T2),它们应该由 PubSub 消息触发。到目前为止 - 这行得通。但现在我想根据随消息发送的值触发 T1 xor T2。出于某种原因,我只是不让这个工作。这是我的事件源和传感器:

    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-a
          eventSourceName: pubsub-event-source-nyc
          eventName: examplex
          filters:
            data:
              - path: body.test
                type: string
                value:
                  - "a"
        - name: pubsub-event-source-dep-b
          eventSourceName: pubsub-event-source-nyc
          eventName: examplex
          filters:
            data:
              - path: body.test
                type: string
                value:
                  - "b"
      triggers:
        - template: #T1
            conditions: "pubsub-event-source-dep-a"
            name: argo-workflow-trigger-wnf59w3zv
            argoWorkflow:
              group: argoproj.io
              version: v1alpha1
              resource: workflows
              operation: submit
              source:
                resource:
                  apiVersion: argoproj.io/v1alpha1
                  kind: Workflow
                  metadata:
                    generateName: nyc-test-template-a-
                    namespace: argo
                  spec:
                    workflowTemplateRef:
                      name: nyc-test-template
        - template: #T2
            conditions: "pubsub-event-source-dep-b"
            name: argo-workflow-trigger-gtdz4ef
            argoWorkflow:
              group: argoproj.io
              version: v1alpha1
              resource: workflows
              operation: submit
              source:
                resource:
                  apiVersion: argoproj.io/v1alpha1
                  kind: Workflow
                  metadata:
                    generateName: nyc-test-template-b-
                    namespace: argo
                  spec:
                    workflowTemplateRef:
                      name: nyc-test-template

如果 body.test = "a" 第一个触发器 (T1) 应该被激活,如果 body.test = "b" 第二个 (T2)。

现在,发生的事情是这样的:

  • 如果我发送{"test":"a"}- 只有 T1 被触发 - 好
  • 如果我发送{"test":"b"}- 什么都不会触发 - 不好:/

有任何想法吗?

4

0 回答 0