From 810d0632315bb80a6dbabc3deadd627f2fd763fd Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Thu, 18 Apr 2024 17:10:57 -0300 Subject: [PATCH 1/3] Add a note about Knative deployment model in the operator Signed-off-by: Ricardo Zanini --- .../cloud/operator/customize-podspec.adoc | 54 ++++++++++++++++++- .../pages/cloud/operator/known-issues.adoc | 11 ---- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc b/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc index 7ec73c4b3..15fece73e 100644 --- a/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc +++ b/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc @@ -7,8 +7,9 @@ :k8s_resources_limits_url: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ :k8s_podspec_api_url: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podspec-v1-core +:knative_serving_service_url: https://github.com/knative/specs/blob/main/specs/serving/knative-api-specification-1.0.md#service -This document describes how to customize the pod specification definition in thew `SonataFlow` custom resource. +This document describes how to customize the pod specification definition in the `SonataFlow` custom resource. Sometimes you may have a specific requirement to deploy containers on Kubernetes or OpenShift such as setting link:{k8s_resources_limits_url}[Resource Limits]. @@ -49,6 +50,49 @@ The `.spec.podTemplate` attribute has the majority of fields defined in the defa The `.spec.podTemplate.container` is a special attribute that you won't find in the default Kubernetes API. The reason is to avoid misconfiguration when users require to change the specific container where the workflow application is deployed. +== Deployment Model + +By default, the {operator_name} deploys a `SonataFlow` instance in a regular Kubernetes Deployment object. Although it's possible to change this behavior and deploy the workflow instance as a link:{knative_serving_service_url}[Knative Serving Service] instead. + +To change the deployment to Knative, set the `.spec.podTemplate.deploymentModel` attribute to `knative`. For example: + +.Setting PodSpec Resources Limits example +[source,yaml,subs="attributes+"] +---- +apiVersion: sonataflow.org/v1alpha08 +kind: SonataFlow +metadata: + name: simple + annotations: + sonataflow.org/description: Simple example on k8s! + sonataflow.org/version: 0.0.1 + sonataflow.org/version: preview +spec: + podTemplate: + deploymentModel: knative <1> + flow: + start: HelloWorld + states: + - name: HelloWorld + type: inject + data: + message: Hello World + end: true +---- + +<1> The `deploymentModel` attribute + +After changing the deployment model to `knative`, the `SonataFlow` instance will be deployed as a Knative Serving Service. + +[IMPORTANT] +==== +It's not possible to deploy a `SonataFlow` instance as a Knative Service in dev profile. In this profile, this attribute is ignored by the operator. +==== + +Note that not every use case leverage a Knative deployment. Long-running workflow instances, for example, that calls services that might take too long to respond, might not be an ideal deployment model. Opt to use Knative deployments for workflows that won't take too long to run. + +The exception are workflows that have callback states. In this case, you must configure xref:cloud/operator/using-persistence.adoc[persistence]. This is required becase once the workflow waits for the event to resume the execution, Knative will kill the pod. Since the workflow has persistence, it will resume the execution once it receives the callback event. + == Customization Exceptions Besides customizing the default container, you can add more `containers`, `initContainers`, or `volumes` to the pod. There are a few exceptions listed below: @@ -167,3 +211,11 @@ It's advised that the SonataFlow `.spec.flow` definition and the workflow built ==== xref:cloud/operator/known-issues.adoc[It's on the roadmap] to add integrity check to the built images provided to the operator by customizing the default container. ==== + +== Additional resources + +* xref:cloud/operator/developing-workflows.adoc[] +* xref:cloud/operator/build-and-deploy-workflows.adoc[] +* xref:cloud/operator/building-custom-images.adoc[] + +include::../../../pages/_common-content/report-issue.adoc[] \ No newline at end of file diff --git a/serverlessworkflow/modules/ROOT/pages/cloud/operator/known-issues.adoc b/serverlessworkflow/modules/ROOT/pages/cloud/operator/known-issues.adoc index b25a5efe0..b61c0e61f 100644 --- a/serverlessworkflow/modules/ROOT/pages/cloud/operator/known-issues.adoc +++ b/serverlessworkflow/modules/ROOT/pages/cloud/operator/known-issues.adoc @@ -20,29 +20,18 @@ The following issues are currently being prioritized: === Workflow Productization Profile -- link:https://issues.redhat.com/browse/KOGITO-8524[Enable toggle Workflow CR from devmode to production mode and vice-versa] -- link:https://issues.redhat.com/browse/KOGITO-8792[Review build failures and signal the reasoning in the Events API] - link:https://issues.redhat.com/browse/KOGITO-8806[Evaluate internal registry integration on OpenShift, Kubernetes and Minikube] === Knative Integration - link:https://issues.redhat.com/browse/KOGITO-9812[SonataFlow Operator integration with Knative Eventing] -- link:https://issues.redhat.com/browse/KOGITO-8496[Knative Serving Extension for Serverless Workflow specification] - -=== Kubernetes and OpenShift Integration - -- link:https://issues.redhat.com/browse/KOGITO-8493[Implement Serverless Workflow custom function for OpenShift] -- link:https://issues.redhat.com/browse/KOGITO-8492[Implement Serverless Workflow custom function for Kubernetes] === Supporting Services -- link:https://issues.redhat.com/browse/KOGITO-9740[Support Data Index Deployment on Kubernetes] -- link:https://issues.redhat.com/browse/KOGITO-9742[Support Jobs Service Deployment on Kubernetes] - link:https://issues.redhat.com/browse/KOGITO-9277[SonataFlow Operator and Kubesmarts integration] === GitOps -- link:https://issues.redhat.com/browse/KOGITO-9084[Enable Workflows Deployment GitOps] - link:https://issues.redhat.com/browse/KOGITO-9527[Extend the SonataFlow Operator with Jib builder] - link:https://issues.redhat.com/browse/KOGITO-9833[Add external built image integrity validation] - link:https://issues.redhat.com/browse/KOGITO-9845[Add .spec.resources mount to a built image] From c8aa82c4c5ffead1b4ad52f8052e5abbfbd3a52e Mon Sep 17 00:00:00 2001 From: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Date: Fri, 19 Apr 2024 14:35:54 -0300 Subject: [PATCH 2/3] Update serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc Co-authored-by: Jakub Schwan --- .../modules/ROOT/pages/cloud/operator/customize-podspec.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc b/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc index 15fece73e..762f7def3 100644 --- a/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc +++ b/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc @@ -91,7 +91,7 @@ It's not possible to deploy a `SonataFlow` instance as a Knative Service in dev Note that not every use case leverage a Knative deployment. Long-running workflow instances, for example, that calls services that might take too long to respond, might not be an ideal deployment model. Opt to use Knative deployments for workflows that won't take too long to run. -The exception are workflows that have callback states. In this case, you must configure xref:cloud/operator/using-persistence.adoc[persistence]. This is required becase once the workflow waits for the event to resume the execution, Knative will kill the pod. Since the workflow has persistence, it will resume the execution once it receives the callback event. +The exception are workflows that have callback states. In this case, you must configure xref:cloud/operator/using-persistence.adoc[persistence]. This is required because once the workflow waits for the event to resume the execution, Knative will kill the pod. Since the workflow has persistence, it will resume the execution once it receives the callback event. == Customization Exceptions From e20d3bfbc95e6952194e729c0593ff6bff0a26ea Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Wed, 8 May 2024 16:37:56 -0300 Subject: [PATCH 3/3] Add a note about Knative and initContainers Signed-off-by: Ricardo Zanini --- .../modules/ROOT/pages/cloud/operator/customize-podspec.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc b/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc index 762f7def3..3fd4dd3eb 100644 --- a/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc +++ b/serverlessworkflow/modules/ROOT/pages/cloud/operator/customize-podspec.adoc @@ -8,6 +8,8 @@ :k8s_resources_limits_url: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ :k8s_podspec_api_url: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podspec-v1-core :knative_serving_service_url: https://github.com/knative/specs/blob/main/specs/serving/knative-api-specification-1.0.md#service +:knative_serving_initcontainer: https://knative.dev/docs/serving/configuration/feature-flags/#kubernetes-init-containers +:kubernetes_init_containers: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ This document describes how to customize the pod specification definition in the `SonataFlow` custom resource. @@ -93,6 +95,8 @@ Note that not every use case leverage a Knative deployment. Long-running workflo The exception are workflows that have callback states. In this case, you must configure xref:cloud/operator/using-persistence.adoc[persistence]. This is required because once the workflow waits for the event to resume the execution, Knative will kill the pod. Since the workflow has persistence, it will resume the execution once it receives the callback event. +Knative **does not support** link:{kubernetes_init_containers}[`initContainers`] by default. If your workflow requires it, you must first enable the extension in the Knative installation. See more information on the link:{knative_serving_initcontainer}[Knative documentation]. + == Customization Exceptions Besides customizing the default container, you can add more `containers`, `initContainers`, or `volumes` to the pod. There are a few exceptions listed below: