|
| 1 | +--- |
| 2 | +apiVersion: argoproj.io/v1alpha1 |
| 3 | +kind: Sensor |
| 4 | +metadata: |
| 5 | + name: cinder-oslo-event |
| 6 | + annotations: |
| 7 | + workflows.argoproj.io/title: Process oslo_events for cinder volume type access |
| 8 | + workflows.argoproj.io/description: |+ |
| 9 | + Triggers on the following Cinder Events: |
| 10 | +
|
| 11 | + - volume_type_project.access.add |
| 12 | + - volume_type_project.access.remove |
| 13 | +
|
| 14 | + Submits workflow using workflowtemplate/openstack-oslo-event |
| 15 | +
|
| 16 | + Defined in `components/site-workflows/sensors/sensor-cinder-oslo-event.yaml` |
| 17 | +spec: |
| 18 | + dependencies: |
| 19 | + - eventName: notifications |
| 20 | + eventSourceName: openstack-cinder |
| 21 | + name: oslo-event-type |
| 22 | + transform: |
| 23 | + # the event is a string-ified JSON so we need to decode it |
| 24 | + jq: '{body: (.body["oslo.message"] | fromjson)}' |
| 25 | + filters: |
| 26 | + dataLogicalOperator: "and" |
| 27 | + data: |
| 28 | + - path: body.event_type |
| 29 | + type: "string" |
| 30 | + # any of the values will trigger |
| 31 | + value: |
| 32 | + - "volume_type_project.access.add" |
| 33 | + - "volume_type_project.access.remove" |
| 34 | + template: |
| 35 | + serviceAccountName: sensor-submit-workflow |
| 36 | + triggers: |
| 37 | + - template: |
| 38 | + name: cinder-oslo-event |
| 39 | + k8s: |
| 40 | + operation: create |
| 41 | + parameters: |
| 42 | + # first parameter is the parsed oslo.message |
| 43 | + - dest: spec.arguments.parameters.0.value |
| 44 | + src: |
| 45 | + dataKey: body |
| 46 | + dependencyName: oslo-event-type |
| 47 | + source: |
| 48 | + resource: |
| 49 | + apiVersion: argoproj.io/v1alpha1 |
| 50 | + kind: Workflow |
| 51 | + metadata: |
| 52 | + generateName: cinder-oslo-event- |
| 53 | + namespace: argo-events |
| 54 | + spec: |
| 55 | + arguments: |
| 56 | + parameters: |
| 57 | + - name: event-json |
| 58 | + workflowTemplateRef: |
| 59 | + name: openstack-oslo-event |
0 commit comments