From c9ffa1c42081b9d4eb290df0b518c2fa094038a4 Mon Sep 17 00:00:00 2001 From: Marcin-Ramotowski Date: Fri, 1 Aug 2025 22:30:30 +0200 Subject: [PATCH] Configured first test webhook for Argo Workflows --- argo-workflows/eventbus-default.yaml | 13 +++++++++ argo-workflows/permissions.yaml | 38 +++++++++++++++++++++++++ argo-workflows/sensor.yaml | 42 ++++++++++++++++++++++++++++ argo-workflows/source.yaml | 15 ++++++++++ 4 files changed, 108 insertions(+) create mode 100644 argo-workflows/eventbus-default.yaml create mode 100644 argo-workflows/permissions.yaml create mode 100644 argo-workflows/sensor.yaml create mode 100644 argo-workflows/source.yaml diff --git a/argo-workflows/eventbus-default.yaml b/argo-workflows/eventbus-default.yaml new file mode 100644 index 0000000..66b633f --- /dev/null +++ b/argo-workflows/eventbus-default.yaml @@ -0,0 +1,13 @@ +apiVersion: argoproj.io/v1alpha1 +kind: EventBus +metadata: + name: default + namespace: argo-events +spec: + nats: + native: + # Optional, defaults to 3. + # If it is < 3, set it to 3, that is the minimal requirement. + replicas: 3 + # Optional, authen strategy, "none" or "token", defaults to "none" + auth: token \ No newline at end of file diff --git a/argo-workflows/permissions.yaml b/argo-workflows/permissions.yaml new file mode 100644 index 0000000..964109d --- /dev/null +++ b/argo-workflows/permissions.yaml @@ -0,0 +1,38 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: operate-workflow-sa + namespace: argo-events + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: operate-workflow-role + namespace: argo-events +rules: + - apiGroups: [ "argoproj.io" ] + resources: [ "workflows" ] + verbs: [ "*" ] + - apiGroups: [ "argoproj.io" ] + resources: [ "workflowtaskresults" ] + verbs: [ "create", "patch" ] + - apiGroups: [ "" ] + resources: [ "pods" ] + verbs: [ "get", "patch" ] + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: operate-workflow-role-binding + namespace: argo-events +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: operate-workflow-role +subjects: + - kind: ServiceAccount + name: operate-workflow-sa + namespace: argo-events diff --git a/argo-workflows/sensor.yaml b/argo-workflows/sensor.yaml new file mode 100644 index 0000000..712c712 --- /dev/null +++ b/argo-workflows/sensor.yaml @@ -0,0 +1,42 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Sensor +metadata: + name: sensor + namespace: argo-events +spec: + template: + serviceAccountName: operate-workflow-sa + dependencies: + - name: dep + eventSourceName: webhook + eventName: test-hook + triggers: + - template: + name: trigger + k8s: + operation: create + source: + resource: + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + generateName: test-workflow- + spec: + serviceAccountName: operate-workflow-sa + entrypoint: entry-wf + templates: + - name: entry-wf + container: + image: docker/whalesay + command: [cowsay] + args: ["{{ workflow.parameters.argName }}"] + arguments: + parameters: + - name: argName + value: "Default_argName" + parameters: + - src: + dependencyName: dep + dataKey: body.argName + dest: spec.arguments.parameters.0.value \ No newline at end of file diff --git a/argo-workflows/source.yaml b/argo-workflows/source.yaml new file mode 100644 index 0000000..f55576c --- /dev/null +++ b/argo-workflows/source.yaml @@ -0,0 +1,15 @@ +apiVersion: argoproj.io/v1alpha1 +kind: EventSource +metadata: + name: webhook + namespace: argo-events +spec: + service: + ports: + - port: 12000 + targetPort: 12000 + webhook: + test-hook: + endpoint: /example + method: POST + port: "12000" \ No newline at end of file