Skip to content
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
17 changes: 13 additions & 4 deletions antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@ asciidoc:
attributes:
product_name: OpenShift Serverless Logic
context: OpenShift Serverless Logic
kogito_version_redhat: 1.30.0.Final-redhat-00001
kogito_version_redhat: 1.32.0.Final-redhat-00003
quarkus_platform: com.redhat.quarkus.platform
kogito_sw_ga: >-
org.kie.kogito:kogito-quarkus-serverless-workflow
quarkus_version: 2.7.6.Final-redhat-00006
quarkus_version: 2.13.5.Final-redhat-00003
java_min_version: 11+
maven_min_version: 3.8.1
graalvm_min_version: 21.3.0
spec_version: 0.8
vscode_version: 1.66.0
kn_cli_version: 0.25.0
kn_cli_version: 0.26.0
kie_tools_node_min_version: 16.13.2
kie_tools_pnpm_min_version: 7.0.0
kie_tools_golang_min_version: 1.19
docker_min_version: 20.10.7
docker_compose_min_version: 1.27.2
operator_version: v1.32.0
kogito_devservices_imagename: registry.redhat.io/openshift-serverless-1-tech-preview/logic-data-index-ephemeral-rhel8:1.24.0-11
kogito_examples_repository_url: 'https://github.com/kiegroup/kogito-examples'
kogito_sw_examples_url: https://github.com/kiegroup/kogito-examples/tree/1.30.x/serverless-workflow-examples
kogito_sw_examples_url: https://github.com/kiegroup/kogito-examples/tree/1.32.x/serverless-workflow-examples
kogito_examples_url: 'https://github.com/kiegroup/kogito-examples.git'
kogito_apps_url: https://github.com/kiegroup/kogito-apps/tree/main
quarkus_cli_url: 'https://quarkus.io/guides/cli-tooling'
Expand All @@ -35,6 +36,7 @@ asciidoc:
https://github.com/serverlessworkflow/specification/blob/0.8.x/specification.md
Copy link
Member

Choose a reason for hiding this comment

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

We need to update the downstream versions here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

quarkus_version: 2.13.5.Final-redhat-00003
kogito_version_redhat: 1.32.0.Final-redhat-00003
kn_cli_version: 0.26.0

cloud_events_url: 'https://cloudevents.io/'
cloud_events_sdk_url: 'https://github.com/cloudevents/sdk-java'
cloud_events_git_url: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents
open_api_spec_url: 'https://spec.openapis.org/oas/v3.1.0.html'
quarkus_openapi_gen_url: 'https://github.com/quarkiverse/quarkus-openapi-generator'
kie_tools_releases_page_url: 'https://github.com/kiegroup/kie-tools/releases'
Expand All @@ -47,6 +49,7 @@ asciidoc:
maven_install: 'https://maven.apache.org/install.html'
docker_install: 'https://docs.docker.com/engine/install/'
podman_install: 'https://docs.podman.io/en/latest/'
open_api_swagger_spec_url: https://swagger.io/docs/specification
kubectl_install: 'https://kubernetes.io/docs/tasks/tools/install-kubectl'
java_install_url: 'https://www.java.com/en/download/help/download_options.html'
maven_install_url: 'https://maven.apache.org/install.html'
Expand All @@ -66,3 +69,9 @@ asciidoc:
openshift_application_data_services_service_account_url: https://console.redhat.com/application-services/service-accounts
openshift_application_data_services_service_registry_url: https://console.redhat.com/application-services/service-registry
openshift_application_data_services_apache_kafka_url: https://console.redhat.com/application-services/streams/kafkas
camel_url: https://camel.apache.org/
# must align this version
camel_extensions_url: https://camel.apache.org/camel-quarkus/2.14.x/reference/extensions
kaoto_url: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-kaoto

minikube_url: https://minikube.sigs.k8s.io
8 changes: 6 additions & 2 deletions modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
**** xref:serverless-logic:eventing/consume-produce-events-with-knative-eventing.adoc[Consuming and producing events on Knative Eventing]
**** xref:serverless-logic:eventing/event-correlation-with-workflows.adoc[Event correlation in {context}]
**** xref:serverless-logic:eventing/working-with-callbacks.adoc[Callback state in {context}]
**** xref:serverless-logic:eventing/working-with-openapi-callbacks.adoc[OpenAPI Callback in {context}]
*** Security
**** xref:serverless-logic:security/authention-support-for-openapi-services.adoc[Authentication for OpenAPI services in {context}]
**** xref:serverless-logic:security/orchestrating-third-party-services-with-oauth2.adoc[Orchestration of third-party services using OAuth 2.0 authentication in {context}]
Expand All @@ -51,16 +52,19 @@
//**** xref:serverless-logic:testing-and-troubleshooting/development-tools-for-troubleshooting.adoc[Development tools for troubleshooting]
*** Persistence
**** xref:serverless-logic:persistence/persistence-with-postgresql.adoc[Running a workflow service using PostgreSQL]
**** xref:serverless-logic:persistence/postgresql-flyway-migration.adoc[Migrate your PostgreSQL database]
//**** xref:serverless-logic:persistence/workflow-database-for-db-admins.adoc[Workflows database for DB admins]
// **** xref:serverless-logic:persistence/data-consistency.adoc[Data consistency]
*** Cloud
**** xref:serverless-logic:cloud/build-workflow-image-with-quarkus-cli.adoc[Building workflow images using Quarkus CLI]
// **** xref:serverless-logic:cloud/build-workflow-images-with-kn-cli.adoc[Building Workflow Images locally with KN CLI]
// **** xref:serverless-logic:cloud/build-workflow-images-with-tekton.adoc[Building Workflow Images with Tekton Pipelines]
**** xref:serverless-logic:cloud/deploying-on-minikube.adoc[Deploying your {context} application on Minikube]
// **** xref:serverless-logic:cloud/deploying-on-kubernetes-cluster.adoc[Deploying on Kubernetes Clusters]
**** xref:serverless-logic:cloud/deploying-on-kubernetes.adoc[Deploying your {context} application on Kubernetes]
// **** xref:serverless-logic:cloud/versioning-workflows-in-knative.adoc[Versioning workflows in Knative]
**** xref:serverless-logic:cloud/kubernetes-service-discovery.adoc[Kubernetes service discovery in {context}]
**** xref:serverless-logic:cloud/build-and-deploy-with-serverless-operator-on-kubernetes.adoc[Buiding and deploying a {context} application on Kubernetes using the {product_name} Serverless Operator]


*** Integrations
**** xref:serverless-logic:integrations/expose-metrics-to-prometheus.adoc[Exposing the workflow base metrics to Prometheus]
// **** xref:serverless-logic:integrations/camel-k-integration.adoc[Integrating with Camel-K]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
= (Community Only) = Building and deploying a {context} application on Kubernetes using the {product_name} Operator
:compat-mode!:
// Metadata:
:description: Build and deploy using the OpenShift Serverless Logic Operator a OpenShift Serverless Logic application
:keywords: kogito, workflow, serverless, operator, kubernetes, minikube, openshift
// links
:kogito_serverless_operator_url: https://github.com/kiegroup/kogito-serverless-operator/
:kogito_greeting_example_url: https://github.com/kiegroup/kogito-examples/tree/stable/serverless-workflow-examples/serverless-workflow-greeting-quarkus
:kaniko_issue_url: https://github.com/GoogleContainerTools/kaniko/issues/2201

[NOTE]
====
This feature is meant for a quick preview on community repositories, and it's not part of the developer preview.
====
[NOTE]
====
This feature is meant for a quick preview on community repositories, and it's not part of the developer preview.
====

This document describes how to build and deploy your workflow application using a Kubernetes cluster with the link:{kogito_serverless_operator_url}[{product_name} Operator]. If you don't have any cluster operational, link:{minikube_url}[Minikube] commands are given throughout the guide.

Using the {product_name} Operator, you will be able to build and deploy a {product_name} application only by having a workflow definition.

If you already have a container built and pushed to a container registry and you want to deploy it on the Kubernetes cluster, then you can do it without the operator following the guide xref:cloud/deploying-on-kubernetes.adoc[Deploying your {context} application on Kubernetes].

The link:{kogito_serverless_operator_url}[{product_name} Operator] is currently in Alpha version, is under active development and is at the moment supporting {context} definitions that are using:

* Functions
* States
- Switch including dataConditions
- Inject including data with a transition
* Operations including Actions containing functionRef with arguments
* KeepActive
* AutoRetries
* ExpressionsLang (jq or jsonpath)

.Prerequisites
* A workflow definition.
* A Kubernetes cluster with admin privileges. If you haven't got one prepare, you can use a local link:{minikube_url}[Minikube] instance.
* `kubectl` command-line tool is installed. Otherwise, Minikube provides it.

== Prepare a Minikube instance

[source,shell,subs="attributes+"]
----
minikube start --cpus 4 --memory 4096 --addons registry --addons metrics-server --insecure-registry "10.0.0.0/24" --insecure-registry "localhost:5000"
----

[NOTE]
====
To speed up the build time, you can increase CPUs and memory options so that you minikube instance will have more resources. For example, use `--cpus 12 --memory 16384`.
====

[TIP]
====
If it does not work with the default driver, as known as `docker`, you can try to start with the `podman` driver as follows:
====

.Start minikube with podman driver
[source,shell,subs="attributes+"]
----
minikube start [...] --driver podman
----


[IMPORTANT]
====
There are some issues with the `crio` container runtime and Kaniko that the operator is using. Reference: link:{kaniko_issue_url}[ISSUE-2201]
====

== Setup {product_name} Operator

In order to have an up-and-running instance of the {product_name} Operator you can use the following command:

.Install {product_name} Operator on Kubernetes
[source,shell,subs="attributes+"]
----
kubectl create -f https://raw.githubusercontent.com/kiegroup/kogito-serverless-operator/{operator_version}/operator.yaml
----

You can follow, then, the deployment of the {product_name} Operator:

.Watch the {product_name} Operator pod
[source,shell,subs="attributes+"]
----
kubectl get pod -n kogito-serverless-operator-system --watch
----

You can also follow the operator’s log:

.Watch the {product_name} Operator pod logs
[source,shell,subs="attributes+"]
----
kubectl logs deployment/kogito-serverless-operator-controller-manager -n kogito-serverless-operator-system -f
----

Once the operator is running, it will watch for new custom resources (CR) so that you can prepare your environment to be ready to build a new {context} application based on the definitions you will send to the operator.

== Preparing for the build

You should follow these steps to create a container that you can deploy as a service on Kubernetes.

=== Create a namespace for the building phase

Let's create a new namespace that will hold all the resources that we (or the operator) will create (pods, deployments, services, secretes, config map, and Custom Resources) in this guide.

.Create a namespace for the application to build & run in
[source,bash,subs="attributes+"]
----
kubectl create namespace kogito-workflows
----

=== Create a secret for the container registry authentication
.Create a secret for the container registry authentication
[source,bash,subs="attributes+"]
----
kubectl create secret docker-registry regcred --docker-server=<registry_url> --docker-username=<registry_username> --docker-password=<registry_password> --docker-email=<registry_email> -n kogito-workflows
----

or you can directly import your local docker config into your Kubernetes cluster:

.Create a secret for the container registry authentication based on local docker config
[source,bash,subs="attributes+"]
----
kubectl create secret generic regcred --from-file=.dockerconfigjson=${HOME}/.docker/config.json --type=kubernetes.io/dockerconfigjson -n kogito-workflows
----

=== Create a {product_name} Platform containing the configuration (i.e. registry address, secret) for building your workflows

The {product_name} Platform CR is the resource used to control the behavior of the {product_name} Operator.
It defines the behavior of all Custom Resources (Workflow and Build) in the given namespace.

Since the {product_name} Operator is installed in global mode, you will need to specify a {product_name} Platform CR in each namespace where you want the operator to be executed.
You can find a basic {product_name} Serverless Platform CR example in the `config/samples` folder that you can simply apply to configure your operator.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
You can find a basic {product_name} Serverless Platform CR example in the `config/samples` folder that you can simply apply to configure your operator.
You can find a basic {product_name} Platform CR example in the `config/samples` folder that you can simply apply to configure your operator.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that one ?


.Create a {product_name} Platform CR
[source,bash,subs="attributes+"]
----
kubectl apply -f https://raw.githubusercontent.com/kiegroup/kogito-serverless-operator/{operator_version}/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform.yaml -n kogito-workflows
----

Note: In this Custom Resource, spec.platform.registry.secret is the name of the secret you created just before.

[TIP]
====
You can also update "on-the-fly" the {product_name} Platform CR registry field with this command (change <YOUR_REGISTRY>)

.Create a {product_name} Platform CR with a specific registry
[source,bash,subs="attributes+"]
----
curl https://raw.githubusercontent.com/kiegroup/kogito-serverless-operator/{operator_version}/config/samples/sw.kogito_v1alpha08_kogitoserverlessplatform.yaml | sed "s|address: .*|address: <YOUR_REGISTRY>" | kubectl apply -f -
----

In order to retrieve the Cluster IP address of Minikube's internal registry to configure your platform, you can use the following command:

.Retrieve Minikube registry internal IP
[source,bash,subs="attributes+"]
----
kubectl get svc registry -n kube-system -ojsonpath='{.spec.clusterIP}'
----
====

== Build and deploy your {context} application

You can now send your {product_name} Custom Resource to the operator which includes the {context} definition.

You can find a basic {product_name} Platform CR example in the `config/samples` folder that you can simply apply to configure your operator.

[source,bash,subs="attributes+"]
----
kubectl apply -f https://raw.githubusercontent.com/kiegroup/kogito-serverless-operator/{operator_version}/config/samples/sw.kogito_v1alpha08_kogitoserverlessworkflow.yaml -n kogito-workflows
----
You can check the logs of the build of your workflow via:

.Get the {product_name} application pod logs
[source,bash,subs="attributes+"]
----
kubectl logs kogito-greeting-builder -n kogito-workflows
----

The final pushed image must be printed into the logs at the end of the build.

== Check the {product_name} application is running
In order to check that the {product_name} Greeting application is up and running, you can try to perform a test HTTP call, from the greeting pod.

.Check the greeting application is running
[source,bash,subs="attributes+"]
----
kubectl patch svc greeting -n kogito-workflows -p '{"spec": {"type": "NodePort"}}'
GREETING_SVC=$(minikube service greeting -n kogito-workflows --url)
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name": "John", "language": "English"}' $GREETING_SVC/greeting
----

If everything is working well you should receive a response like this:

.Response from the greeting application
[source,json,subs="attributes+"]
----
{"id":"b5fbfaa3-b125-4e6c-9311-fe5a3577efdd","workflowdata":{"name":"John","language":"English","greeting":"Hello from JSON Workflow, "}}
----
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ After installing the required tooling, you can start building your workflow appl
.Prerequisites
* You have created a Quarkus project.
* Quarkus CLI is installed.
For more information about installing the Quarkus CLI, see link:https://quarkus.io/guides/cli-tooling#installing-the-cli[Installing the Quarkus CLI].
For more information about installing the Quarkus CLI, see link:{quarkus_cli_url}#installing-the-cli[Installing the Quarkus CLI].

.Procedure
. In a command terminal, navigate to your Quarkus project.
Expand Down Expand Up @@ -264,5 +264,7 @@ Example response::

* xref:serverless-logic:cloud/deploying-on-minikube.adoc[Deploying your {context} application on Minikube]
//* xref:serverless-logic:cloud/deploying-on-kubernetes-cluster.adoc[Deploying your Serverless Workflow application on Kubernetes] Guide not available in DP1
* xref:cloud/deploying-on-kubernetes.adoc[Deploying your {context} application on Kubernetes]


include::../../pages/_common-content/report-issue.adoc[]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

--
.Create namespace
[source,shell]
----
kubectl create namespace serverless-workflow-greeting-quarkus
----
--

. Set the Kubernetes context to the newly created namespace using the following command:
+
--
.Set Kubernetes context to a namespace
[source,shell]
----
kubectl config set-context --current --namespace=serverless-workflow-greeting-quarkus
----

After setting the context, all kubectl commands will use the selected namespace. +
You can use the following command to verify the current namespace:

.Verify the current namespace
[source,shell]
----
kubectl config view --minify -o jsonpath='{..namespace}'
----
--

. Deploy your {context} application {deploy_application}.
+
--
The next step is to deploy your workflow application and execute it.
You can read the further sections on the different procedures to deploy your {context} application.

[NOTE]
====
You can use the native image due to the faster startup. +
For more information about installing the workflow application, see xref:cloud/build-workflow-image-with-quarkus-cli.adoc[Building workflow images using Quarkus CLI] document.
====
--
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.Prerequisites
* {cluster_kind}.
* Knative is ready. +
For more information, see {knative_procedure}.
* Knative CLI is installed.
* (Optional) Quarkus CLI is installed. +
For more information, see link:{quarkus_cli_url}[Building Quarkus Apps with Quarkus command line interface (CLI)].
* {context} application container is ready.
15 changes: 15 additions & 0 deletions modules/serverless-logic/pages/cloud/common/_prerequisites.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:kn_cli_url: https://knative.dev/docs/client/install-kn/

.Prerequisites
* Your {context} application is ready to use. +
For more information about building the application container, see xref:cloud/build-workflow-image-with-quarkus-cli.adoc[Building workflow images using Quarkus CLI].

* {environment_prereq}
* `kubectl` {kubectl_prereq}
* Knative CLI is installed. +
For more information, see link:{kn_cli_url}[Install the Knative CLI].
* Knative workflow CLI is installed. +
For more information see xref:tooling/kn-plugin-workflow-overview.adoc[Serverless Workflow plug-in for Knative CLI].
* (Optional) Quarkus CLI is installed. +
For more information, see link:{quarkus_cli_url}[Building Quarkus Apps with Quarkus command line interface (CLI)].

Loading