From 56d070942c0056f4e732f9907f9eea9f2d06f456 Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Thu, 14 Nov 2024 12:07:08 +0100 Subject: [PATCH] Add eventing sonataflowplatform spec in chart template Signed-off-by: gabriel-farache --- bundle/manifests/rhdh.redhat.com_orchestrators.yaml | 10 ++++++++++ config/crd/bases/rhdh.redhat.com_orchestrators.yaml | 11 +++++++++++ docs/main/kafka-knative-broker/README.md | 12 +++++------- helm-charts/orchestrator/templates/sonataflows.yaml | 9 +++++++++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/bundle/manifests/rhdh.redhat.com_orchestrators.yaml b/bundle/manifests/rhdh.redhat.com_orchestrators.yaml index 356d05d4..cf286a44 100644 --- a/bundle/manifests/rhdh.redhat.com_orchestrators.yaml +++ b/bundle/manifests/rhdh.redhat.com_orchestrators.yaml @@ -79,6 +79,16 @@ spec: Job Service container image to be used instead of the provided one by SonataFlow type: string + broker: + description: Broker contains the name and namespace of the broker to use if using Knative eventing for components communications + properties: + name: + description: name describes the name of the broker to use + type: string + namespace: + description: namespace describes the namespace on which the broker to use is deployed + type: string + type: object resources: description: Resources contains the requests and limit of CPU and memory resources for the pod instance diff --git a/config/crd/bases/rhdh.redhat.com_orchestrators.yaml b/config/crd/bases/rhdh.redhat.com_orchestrators.yaml index ccc9079b..afd2d5b3 100644 --- a/config/crd/bases/rhdh.redhat.com_orchestrators.yaml +++ b/config/crd/bases/rhdh.redhat.com_orchestrators.yaml @@ -443,6 +443,17 @@ spec: description: This field contains the location of a custom Job Service container image to be used instead of the provided one by SonataFlow default: type: string + broker: + description: Broker contains the name and namespace of the broker to use if using Knative eventing for components communications + properties: + name: + description: name describes the name of the broker to use + type: string + namespace: + description: namespace describes the namespace on which the broker to use is deployed + type: string + type: object + type: object type: object tekton: diff --git a/docs/main/kafka-knative-broker/README.md b/docs/main/kafka-knative-broker/README.md index a60dd09b..cf455330 100644 --- a/docs/main/kafka-knative-broker/README.md +++ b/docs/main/kafka-knative-broker/README.md @@ -56,17 +56,15 @@ spec: name: kafka-broker-config namespace: knative-eventing" | oc apply -f - ``` -3. Configure the `sonataflowplatforms.sonataflow.org`: given that the resource is created under the `sonataflow-infra` namespace: +3. Configure the `sonataflowplatforms.sonataflow.org`: given that the `Orchestrator` is names `orchestrator-sample` and was created under the `orchestrator` namespace: ```console -oc -n sonataflow-infra patch sonataflowplatforms.sonataflow.org sonataflow-platform --type merge \ +oc -n orchestrator patch sorchestrators.rhdh.redhat.com orchestrator-sample --type merge \ -p ' { "spec": { - "eventing": { - "broker": { - "ref": { - "apiVersion": "eventing.knative.dev/v1", - "kind": "Broker", + "orchestrator": { + "sonataflowPlatform": { + "broker": { "name": "", "namespace": "" } diff --git a/helm-charts/orchestrator/templates/sonataflows.yaml b/helm-charts/orchestrator/templates/sonataflows.yaml index e6523c95..ffdadd70 100644 --- a/helm-charts/orchestrator/templates/sonataflows.yaml +++ b/helm-charts/orchestrator/templates/sonataflows.yaml @@ -32,6 +32,15 @@ spec: limits: memory: {{ .Values.orchestrator.sonataflowPlatform.resources.limits.memory }} cpu: {{ .Values.orchestrator.sonataflowPlatform.resources.limits.cpu }} + {{- if (and (.Values.orchestrator.sonataflowPlatform.broker.name) (.Values.orchestrator.sonataflowPlatform.broker.name)) }} + eventing: + broker: + ref: + apiVersion: eventing.knative.dev/v1 + kind: Broker + name: {{ .Values.orchestrator.sonataflowPlatform.broker.name }} + namespace: {{ .Values.orchestrator.sonataflowPlatform.broker.namespace }} + {{- end }} services: dataIndex: enabled: true