github.com/argoproj/argo-events@v1.9.1/examples/sensors/trigger-with-policy.yaml (about)

     1  apiVersion: argoproj.io/v1alpha1
     2  kind: Sensor
     3  metadata:
     4    name: webhook
     5  spec:
     6    template:
     7      serviceAccountName: operate-workflow-sa
     8    dependencies:
     9      - name: test-dep
    10        eventSourceName: webhook
    11        eventName: example
    12  
    13    # If set to true, marks sensor state as `error` if the previous trigger round fails.
    14    # Once sensor state is set to `error`, no further triggers will be processed.
    15    # Defaults to false
    16    errorOnFailedRound: true
    17  
    18    triggers:
    19      - template:
    20          name: trigger-1
    21  
    22          # Policy to configure backoff and execution criteria for the trigger
    23          # Because the sensor is able to trigger any K8s resource, it determines the resource state by looking at the resource's labels.
    24          policy:
    25            k8s:
    26              # Backoff before checking the resource labels
    27              backoff:
    28                # Duration is the duration in nanoseconds, or strings like "3s", "2m"
    29                duration: 1s # 1 second
    30                # Duration is multiplied by factor each iteration
    31                factor: 2
    32                # The amount of jitter applied each iteration
    33                jitter: 0.1
    34                # Exit with error after these many steps
    35                steps: 5
    36              # labels set on the resource decide if the resource has transitioned into the success state.
    37              labels:
    38                workflows.argoproj.io/phase: Succeeded
    39              # Determines whether trigger should be marked as failed if the backoff times out and sensor is still unable to decide the state of the trigger.
    40              # defaults to false
    41              errorOnBackoffTimeout: true
    42  
    43          k8s:
    44            operation: create
    45            source:
    46              resource:
    47                apiVersion: argoproj.io/v1alpha1
    48                kind: Workflow
    49                metadata:
    50                  generateName: webhook-
    51                spec:
    52                  entrypoint: whalesay
    53                  arguments:
    54                    parameters:
    55                    - name: message
    56                      # the value will get overridden by the event payload from test-dep
    57                      value: hello world
    58                  templates:
    59                  - name: whalesay
    60                    inputs:
    61                      parameters:
    62                      - name: message
    63                    container:
    64                      image: docker/whalesay:latest
    65                      command: [cowsay]
    66                      args: ["{{inputs.parameters.message}}"]
    67            parameters:
    68              - src:
    69                  dependencyName: test-dep
    70                  dataKey: body
    71                dest: spec.arguments.parameters.0.value