From b64e1ba86e320f311d4437ce1ce91c4a90710352 Mon Sep 17 00:00:00 2001 From: richardwang98 Date: Fri, 8 Mar 2024 15:55:59 -0500 Subject: [PATCH 1/2] doc for knative eventing in operator --- serverlessworkflow/modules/ROOT/nav.adoc | 1 + ...onfiguring-knative-eventing-resources.adoc | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc diff --git a/serverlessworkflow/modules/ROOT/nav.adoc b/serverlessworkflow/modules/ROOT/nav.adoc index 8e254442f..160b63617 100644 --- a/serverlessworkflow/modules/ROOT/nav.adoc +++ b/serverlessworkflow/modules/ROOT/nav.adoc @@ -74,6 +74,7 @@ *** xref:cloud/operator/building-custom-images.adoc[Building Custom Images] *** xref:cloud/operator/customize-podspec.adoc[Custom Workflow PodSpec] *** xref:cloud/operator/service-discovery.adoc[Service Discovery] +*** xref:cloud/operator/configuring-knative-eventing-resources.adoc[Knative Eventing] *** xref:cloud/operator/known-issues.adoc[Roadmap and Known Issues] * Integrations ** xref:integrations/core-concepts.adoc[] diff --git a/serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc b/serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc new file mode 100644 index 000000000..e9716323a --- /dev/null +++ b/serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc @@ -0,0 +1,59 @@ += Knative Eventing +:compat-mode!: +// Metadata: +:description: Configuration of knatve eventing deployed by the operator +:keywords: kogito, sonataflow, workflow, serverless, operator, kubernetes, knative, knative-eventing, events + +This document describes how you can configure the workflows to let operator create the knative eventing resources on Kubernetes. + +{operator_name} can analyze the event definitions from the `spec.flow` and create `SinkBinding`/`Trigger` based on the type of the event. Then the workflow service can utilize them for event communications. The same purpose of this feature in quarkus extension can be found xref:use-cases/advanced-developer-use-cases/event-orchestration/consume-produce-events-with-knative-eventing.adoc#ref-example-sw-event-definition-knative[here]. + +== Prerequisite +1. Knative is installed on the cluster and Knative Eventing is initiated with a `KnativeEventing` CR. +2. a broker named `default` is created. Currently all Triggers created by the {operator_name} will read events from `default` + +== Configuring the workflow + +For the operator to create the `SinkBinding` resources, the workflow must provide the sink information in `spec.sink`. + +.Example of a workflow with events +[source,yaml,subs="attributes+"] +-- +apiVersion: sonataflow.org/v1alpha08 +kind: SonataFlow +metadata: +... +spec: + sink: + ref: <1> + name: default + namespace: greeting + apiVersion: eventing.knative.dev/v1 + kind: Broker + flow: + events: <2> + - name: requestQuote + type: kogito.sw.request.quote + kind: produced + - name: aggregatedQuotesResponse, + type: kogito.loanbroker.aggregated.quotes.response, + kind: consumed, + source: /kogito/serverless/loanbroker/aggregator +... +-- +<1> `spec.sink.ref` defines the sink that all created sinkBinding will use as the destination sink for producing events +<2> `spec.flow.events` lists all the events referenced in the workflow. Events with `produced` kind will trigger the creation of `SinkBindings` by the {operator_name}, while those labeled as `consumed` will lead to the generation of `Triggers`. + +[NOTE] +==== +Knative resources is not watched by the operator, indicating that they won't undergo automatic reconciliation. This grants users the freedom to make updates at their discretion. +==== + +== Additional resources + +* https://knative.dev/docs/eventing/[Knative Eventing official site] +* xref:use-cases/advanced-developer-use-cases/event-orchestration/consume-produce-events-with-knative-eventing.adoc[quarkus extension for knative eventing] +* xref:job-services/core-concepts.adoc#knative-eventing-supporting-resources[knative eventing for Job service] +* xref:data-index/data-index-core-concepts.adoc#_knative_eventing[knative eventing for data index] + +include::../../../pages/_common-content/report-issue.adoc[] \ No newline at end of file From 23dd91cad553f774df418edd4dfa1deddd2b086e Mon Sep 17 00:00:00 2001 From: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Date: Tue, 12 Mar 2024 08:35:58 -0300 Subject: [PATCH 2/2] Incorporating @kaldesai review Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../operator/configuring-knative-eventing-resources.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc b/serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc index e9716323a..696554c44 100644 --- a/serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc +++ b/serverlessworkflow/modules/ROOT/pages/cloud/operator/configuring-knative-eventing-resources.adoc @@ -10,7 +10,7 @@ This document describes how you can configure the workflows to let operator crea == Prerequisite 1. Knative is installed on the cluster and Knative Eventing is initiated with a `KnativeEventing` CR. -2. a broker named `default` is created. Currently all Triggers created by the {operator_name} will read events from `default` +2. A broker named `default` is created. Currently all Triggers created by the {operator_name} will read events from `default` == Configuring the workflow @@ -46,7 +46,7 @@ spec: [NOTE] ==== -Knative resources is not watched by the operator, indicating that they won't undergo automatic reconciliation. This grants users the freedom to make updates at their discretion. +Knative resources are not watched by the operator, indicating they will not undergo automatic reconciliation. This grants users the freedom to make updates at their preference. ==== == Additional resources