github.com/argoproj/argo-events@v1.9.1/examples/sensors/complete-trigger-parameterization.yaml (about) 1 # Consider an event payload, 2 # 3 # { 4 # "name": "trigger-wf-1", 5 # "namespace": "argo-events", 6 # "bucket": "mybucket", 7 # "port": "9000", 8 # "key": "hello.yaml", 9 # "image": "docker/busybox", 10 # } 11 # 12 # The example refers to workflow stored on a S3 bucket. With normal sensor spec, you would hard-code the S3 bucket name, object key and other things in trigger. 13 # But user would like to have dynamic trigger spec where depending on the data in the payload. 14 # The example data payload contains information like bucket, key, name, namespace which is used to replace the placeholders in trigger spec. 15 # The image in payload will be used to replace the image in the workflow. 16 17 # A parameter takes a key from event payload, extracts the value and set it at the destination. 18 19 apiVersion: argoproj.io/v1alpha1 20 kind: Sensor 21 metadata: 22 name: webhook 23 spec: 24 template: 25 serviceAccountName: operate-workflow-sa 26 dependencies: 27 - name: test-dep 28 eventSourceName: webhook 29 eventName: example 30 triggers: 31 - template: 32 name: THIS_WILL_BE_REPLACED_BY_NAME_FROM_EVENT 33 k8s: 34 operation: create 35 source: 36 s3: 37 bucket: 38 name: THIS_WILL_BE_REPLACED_BUCKET_FROM_EVENT 39 key: THIS_WILL_BE_REPLACED_KEY_FROM_EVENT 40 # endpoint can vary based on your minio installation 41 endpoint: minio-service.argo-events:9000 42 insecure: true 43 accessKey: 44 key: accesskey 45 name: artifacts-minio 46 secretKey: 47 key: secretkey 48 name: artifacts-minio 49 # Apply parameters for workflow resource fetched from the S3 bucket 50 parameters: 51 - src: 52 dependencyName: test-dep 53 dataKey: namespace 54 dest: metadata.namespace 55 - src: 56 dependencyName: test-dep 57 dataKey: image 58 dest: spec.templates.0.container.image 59 # Apply parameters at the template level. 60 parameters: 61 - src: 62 dependencyName: test-dep 63 dataKey: name 64 dest: name 65 - src: 66 dependencyName: test-dep 67 dataKey: bucket 68 dest: k8s.source.s3.bucket.name 69 - src: 70 dependencyName: test-dep 71 dataKey: key 72 dest: k8s.source.s3.bucket.key 73 - src: 74 dependencyName: test-dep 75 dataKey: port 76 dest: k8s.source.s3.endpoint 77 # Append the port to the existing source.s3.endpoint value 78 operation: append