github.com/argoproj/argo-events@v1.9.1/examples/event-sources/resource.yaml (about) 1 apiVersion: argoproj.io/v1alpha1 2 kind: EventSource 3 metadata: 4 name: resource 5 spec: 6 template: 7 serviceAccountName: your-service-account # assign a service account with `get`, `list` and `watch` permissions on the resource being watched. 8 resource: 9 example: 10 # namespace to listen events within 11 namespace: argo-events 12 # resource group 13 group: argoproj.io 14 # resource version 15 version: v1alpha1 16 # resource kind 17 resource: workflows 18 # type of events 19 # possible values are ADD, DELETE, UPDATE 20 # Optional 21 eventTypes: 22 - ADD 23 # optional. 24 filter: 25 # This indicates only watch the events happened after the service start time. 26 afterStart: true 27 # labels and filters are meant to provide K8s API options to filter the object list that are being watched. 28 # Please read https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api for more details. 29 30 # labels provide listing options to K8s API to watch objects 31 labels: 32 - key: app 33 # Supported operations like ==, !=, etc. 34 # Defaults to ==. 35 # Refer https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors for more info. 36 # optional. 37 operation: "==" 38 value: my-workflow 39 40 # # fields provide listing options to K8s API to watch objects 41 # fields: 42 # # It's an extention of https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/. 43 # # Unlike k8s field selector, any arbitrary field like "spec.serviceAccountName" is supported. 44 # - key: metadata.name 45 # # Supported operations like =, ==, !=. 46 # # Defaults to ==. 47 # # optional. 48 # operation: == 49 # # Value could a string or a regex like "my*" 50 # value: my-workflow 51 52 53 # # create event if workflow with prefix "my-workflow" gets modified 54 # example-with-prefix-filter: 55 # namespace: "argo-events" 56 # group: argoproj.io 57 # version: v1alpha1 58 # resource: workflows 59 # eventTypes: 60 # - UPDATE 61 # - ADD 62 # filter: 63 # prefix: "my-workflow" 64 # 65 # # create event when a pod is created before 2019-03-27T010:52:32Z 66 # example-with-created-by-filter: 67 # namespace: "argo-events" 68 # group: argoproj.io 69 # version: v1alpha1 70 # resource: workflows 71 # eventTypes: 72 # - ADD 73 # filter: 74 # createdBy: "2019-04-06T12:52:11Z" 75 # 76 # example-with-multi-filters: 77 # namespace: "argo-events" 78 # group: "" 79 # version: v1 80 # resource: pods 81 # eventTypes: 82 # - ADD 83 # filter: 84 # createdBy: "2019-04-06T12:52:11Z" 85 # labels: 86 # - key: workflows.argoproj.io/completed 87 # operation: == 88 # value: "true" 89 # prefix: "hello" 90 # 91 # # watch for completed workflows in any namespace 92 # example-without-namespace: 93 # # namespace: (omitted to match any namespace) 94 # group: "k8s.io" 95 # version: v1 96 # resource: workflows 97 # eventTypes: 98 # - ADD 99 # filter: 100 # labels: 101 # - key: workflows.argoproj.io/completed 102 # operation: == 103 # value: "true"