Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a note about Knative deployment model in the operator #624

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@

: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 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 +52,51 @@ 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 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].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, didn't know that


== 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 +215,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