-
Notifications
You must be signed in to change notification settings - Fork 28
SRVLOGIC-75: Update openshift knative docs with Serverless Logic Workflow guides for 1.32.0 #89
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
Merged
ricardozanini
merged 12 commits into
openshift-knative:master
from
akumar074:migrate-1.33.x
Feb 10, 2023
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2abfb1d
[KOGITO-8167] Adding event state timeout (#248)
akumar074 33f17f7
[KOGITO-8141][KOGITO-8309] - Enhancing Knative Eventing guide with in…
akumar074 6cb5c4b
[KOGITO-8304] - Document the usage of all-in-one jobs-service image (…
akumar074 361dc3e
[KOGITO-7676] Adding Postgres DB migration guide (#277)
akumar074 4476286
[KOGITO-7282] - [KSW-Guides] Deploying on Kubernetes Clusters (#267)
akumar074 5706638
[KOGITO-8314] [KSW-Guides] Using Serverless Operator to deploy workfl…
akumar074 c0a7c0a
[KOGITO-8250]-Working with Open API callbacks (#285)
akumar074 06d229d
Minor fixes
akumar074 d76c562
Incorporating PR comments
akumar074 8f8c115
add a note that the operator is community only
ricardozanini e2f4980
Operator version fixed
akumar074 872386d
Incorporating PR comments
akumar074 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
modules/serverless-logic/assets/images/core/event-state-timeouts.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.42 KB
(110%)
modules/serverless-logic/assets/images/core/timeout-switch-wokflow-ui.png
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.
200 changes: 200 additions & 0 deletions
200
...-logic/pages/cloud/build-and-deploy-with-serverless-operator-on-kubernetes.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, "}} | ||||||
---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
modules/serverless-logic/pages/cloud/build-workflow-images-with-kn-cli.adoc
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
modules/serverless-logic/pages/cloud/common/_create_namespace_and_deploy_info.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
==== | ||
-- |
8 changes: 8 additions & 0 deletions
8
...erverless-logic/pages/cloud/common/_deploy_workflow_application_requisites.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
15
modules/serverless-logic/pages/cloud/common/_prerequisites.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)]. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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-00003kogito_version_redhat
: 1.32.0.Final-redhat-00003kn_cli_version
: 0.26.0