Skip to content

Commit

Permalink
Add a note about Knative deployment model in the operator
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Zanini <[email protected]>
  • Loading branch information
ricardozanini committed Apr 18, 2024
1 parent 9a25a3f commit 810d063
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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].

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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[]
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 810d063

Please sign in to comment.