Merge pull request #876 from 3dwardch3ng/infra/argo-events
add sensor and workflow
This commit is contained in:
21
infrastructures/argo-events/base/examples/ingress.yaml
Normal file
21
infrastructures/argo-events/base/examples/ingress.yaml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: event-example-ingress
|
||||||
|
namespace: argo-events
|
||||||
|
annotations:
|
||||||
|
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
||||||
|
nginx.ingress.kubernetes.io/use-regex: "true"
|
||||||
|
spec:
|
||||||
|
ingressClassName: nginx
|
||||||
|
rules:
|
||||||
|
- host: "event-example.cluster.edward.sydney"
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- pathType: Prefix
|
||||||
|
path: "/"
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: webhook-eventsource-svc
|
||||||
|
port:
|
||||||
|
number: 12000
|
||||||
33
infrastructures/argo-events/base/examples/sensor.yaml
Normal file
33
infrastructures/argo-events/base/examples/sensor.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: operate-workflow-sa
|
||||||
|
---
|
||||||
|
# Similarly you can use a ClusterRole and ClusterRoleBinding
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: operate-workflow-role
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
verbs:
|
||||||
|
- "*"
|
||||||
|
resources:
|
||||||
|
- workflows
|
||||||
|
- workflowtemplates
|
||||||
|
- cronworkflows
|
||||||
|
- clusterworkflowtemplates
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: operate-workflow-role-binding
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: operate-workflow-role
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: operate-workflow-sa
|
||||||
44
infrastructures/argo-events/base/examples/webhook.yaml
Normal file
44
infrastructures/argo-events/base/examples/webhook.yaml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Sensor
|
||||||
|
metadata:
|
||||||
|
name: webhook
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
serviceAccountName: operate-workflow-sa
|
||||||
|
dependencies:
|
||||||
|
- name: test-dep
|
||||||
|
eventSourceName: webhook
|
||||||
|
eventName: example
|
||||||
|
triggers:
|
||||||
|
- template:
|
||||||
|
name: webhook-workflow-trigger
|
||||||
|
k8s:
|
||||||
|
operation: create
|
||||||
|
source:
|
||||||
|
resource:
|
||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Workflow
|
||||||
|
metadata:
|
||||||
|
generateName: webhook-
|
||||||
|
spec:
|
||||||
|
entrypoint: whalesay
|
||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
- name: message
|
||||||
|
# the value will get overridden by event payload from test-dep
|
||||||
|
value: hello world
|
||||||
|
templates:
|
||||||
|
- name: whalesay
|
||||||
|
inputs:
|
||||||
|
parameters:
|
||||||
|
- name: message
|
||||||
|
container:
|
||||||
|
image: docker/whalesay:latest
|
||||||
|
command: [cowsay]
|
||||||
|
args: ["{{inputs.parameters.message}}"]
|
||||||
|
parameters:
|
||||||
|
- src:
|
||||||
|
dependencyName: test-dep
|
||||||
|
dataKey: body
|
||||||
|
dest: spec.arguments.parameters.0.value
|
||||||
29
infrastructures/argo-events/base/examples/workflow.yaml
Normal file
29
infrastructures/argo-events/base/examples/workflow.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# This file enables a Workflow Pod (running Emissary executor) to be able to read and patch WorkflowTaskResults,
|
||||||
|
# which get shared with the Workflow Controller. The Controller uses the results to update Workflow status.
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
workflows.argoproj.io/description: |
|
||||||
|
Recomended minimum permissions for the `emissary` executor.
|
||||||
|
name: executor
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- argoproj.io
|
||||||
|
resources:
|
||||||
|
- workflowtaskresults
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- patch
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: executor-default
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: executor
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: default
|
||||||
@@ -9,4 +9,8 @@ resources:
|
|||||||
- ./deployment.yaml
|
- ./deployment.yaml
|
||||||
- ./service.yaml
|
- ./service.yaml
|
||||||
- ./examples/eventbus.yaml
|
- ./examples/eventbus.yaml
|
||||||
- ./examples/event-source.yaml
|
- ./examples/event-source.yaml
|
||||||
|
- ./examples/ingress.yaml
|
||||||
|
- ./examples/sensor.yaml
|
||||||
|
- ./examples/workflow.yaml
|
||||||
|
- ./examples/webhook.yaml
|
||||||
Reference in New Issue
Block a user