-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[SRVLOGIC-469]: Deploying workflows chapter does not use kn worklow plugin #85916
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
base: serverless-docs-main
Are you sure you want to change the base?
Changes from all commits
0537eaa
bf355e5
c35c75b
dd7ad30
f3fe3b7
e85b0b2
e62ba73
1230083
de488c5
edddd29
9670f45
b0c912c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,89 +12,46 @@ You can create a `SonataFlow` custom resource (CR) on {ocp-product-title} and {S | |||||
|
||||||
* You have an {ServerlessLogicOperatorName} installed on your cluster. | ||||||
* You have access to an {ServerlessLogicProductName} project with the appropriate roles and permissions to create applications and other workloads in {ocp-product-title}. | ||||||
* You have installed the {ServerlessLogicProductName} `kn-workflow` CLI plugin. | ||||||
* You have installed the OpenShift CLI `(oc)`. | ||||||
|
||||||
.Procedure | ||||||
|
||||||
. Create a workflow YAML file similar to the following: | ||||||
+ | ||||||
[source,yaml] | ||||||
---- | ||||||
apiVersion: sonataflow.org/v1alpha08 | ||||||
kind: SonataFlow | ||||||
metadata: | ||||||
name: greeting | ||||||
annotations: | ||||||
sonataflow.org/description: Greeting example on k8s! | ||||||
sonataflow.org/version: 0.0.1 | ||||||
spec: | ||||||
flow: | ||||||
start: ChooseOnLanguage | ||||||
functions: | ||||||
- name: greetFunction | ||||||
type: custom | ||||||
operation: sysout | ||||||
states: | ||||||
- name: ChooseOnLanguage | ||||||
type: switch | ||||||
dataConditions: | ||||||
- condition: "${ .language == \"English\" }" | ||||||
transition: GreetInEnglish | ||||||
- condition: "${ .language == \"Spanish\" }" | ||||||
transition: GreetInSpanish | ||||||
defaultCondition: GreetInEnglish | ||||||
- name: GreetInEnglish | ||||||
type: inject | ||||||
data: | ||||||
greeting: "Hello from JSON Workflow, " | ||||||
transition: GreetPerson | ||||||
- name: GreetInSpanish | ||||||
type: inject | ||||||
data: | ||||||
greeting: "Saludos desde JSON Workflow, " | ||||||
transition: GreetPerson | ||||||
- name: GreetPerson | ||||||
type: operation | ||||||
actions: | ||||||
- name: greetAction | ||||||
functionRef: | ||||||
refName: greetFunction | ||||||
arguments: | ||||||
message: ".greeting+.name" | ||||||
end: true | ||||||
---- | ||||||
|
||||||
. Apply the `SonataFlow` workflow definition to your {ocp-product-title} namespace by running the following command: | ||||||
. In your project application directory, execute the following command: | ||||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc apply -f <workflow-name>.yaml -n <your_namespace> | ||||||
$ kn workflow gen-manifest --profile=preview -n <namespace> | ||||||
---- | ||||||
+ | ||||||
.Example command for the `greetings-workflow.yaml` file: | ||||||
This command generates {ocp-product-title} YAML manifests based on your `workflow.sw.json|yaml` definition. The default location is the `<project_application_dir>/manifests` directory. | ||||||
You can modify these files to your preference, however, when you rerun the above command, the changes will be overwritten. Use the `--custom-generated-manifests-dir` or `-c` flag to generate the files in different locations. | ||||||
|
||||||
. Deploy the `SonataFlow` workflow application to your {ocp-product-title} namespace by running the following command: | ||||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc apply -f greetings-workflow.yaml -n workflows | ||||||
$ kn workflow deploy --custom-manifests-dir=./manifests -n <namespace> | ||||||
---- | ||||||
|
||||||
. List all the build configurations by running the following command: | ||||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc get buildconfigs -n workflows | ||||||
$ oc get buildconfigs -n <namespace> | ||||||
---- | ||||||
|
||||||
. Get the logs of the build process by running the following command: | ||||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc logs buildconfig/<workflow-name> -n <your_namespace> | ||||||
$ oc logs buildconfig/<workflow-name> -n <namespace> | ||||||
---- | ||||||
+ | ||||||
.Example command for the `greetings-workflow.yaml` file: | ||||||
.Example command for a workflow that has ID attribute with value `greeting`: | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc logs buildconfig/greeting -n workflows | ||||||
$ oc logs buildconfig/greeting -n <namespace> | ||||||
---- | ||||||
|
||||||
.Verification | ||||||
|
@@ -103,7 +60,7 @@ $ oc logs buildconfig/greeting -n workflows | |||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc get pods -n <your_namespace> | ||||||
$ oc get pods -n <namespace> | ||||||
---- | ||||||
+ | ||||||
Ensure that the pod corresponding to your workflow is running. | ||||||
|
@@ -112,5 +69,13 @@ Ensure that the pod corresponding to your workflow is running. | |||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc logs pod/<pod-name> -n workflows | ||||||
$ oc logs pod/<pod-name> -n <namespace> | ||||||
---- | ||||||
|
||||||
.Cleanup | ||||||
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. Technically Could this instead just be the last step in the normal |
||||||
. To cleanup the deployment, delete the projects resources running the following command: | ||||||
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. Either way though, if this stays as a single-step procedure, use an unordered list (per guidelines) and use "by running":
Suggested change
|
||||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ kn workflow undeploy -n <namespace> | ||||||
---- |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,75 +12,39 @@ You can deploy your local workflow on {ocp-product-title} in Dev mode. You can u | |||||||||
|
||||||||||
* You have {ServerlessLogicOperatorName} installed on your cluster. | ||||||||||
* You have access to a {ServerlessLogicProductName} project with the appropriate roles and permissions to create applications and other workloads in {ocp-product-title}. | ||||||||||
* You have installed the {ServerlessLogicProductName} `kn-workflow` CLI plugin. | ||||||||||
* You have installed the OpenShift CLI `(oc)`. | ||||||||||
|
||||||||||
.Procedure | ||||||||||
|
||||||||||
. Create the workflow configuration YAML file. | ||||||||||
. Login to your cluster, by running the following command: | ||||||||||
+ | ||||||||||
.Example `workflow-dev.yaml` file | ||||||||||
[source,yaml] | ||||||||||
---- | ||||||||||
apiVersion: sonataflow.org/v1alpha08 | ||||||||||
kind: SonataFlow | ||||||||||
metadata: | ||||||||||
name: greeting <1> | ||||||||||
annotations: | ||||||||||
sonataflow.org/description: Greeting example on k8s! | ||||||||||
sonataflow.org/version: 0.0.1 | ||||||||||
sonataflow.org/profile: dev <2> | ||||||||||
spec: | ||||||||||
flow: | ||||||||||
start: ChooseOnLanguage | ||||||||||
functions: | ||||||||||
- name: greetFunction | ||||||||||
type: custom | ||||||||||
operation: sysout | ||||||||||
states: | ||||||||||
- name: ChooseOnLanguage | ||||||||||
type: switch | ||||||||||
dataConditions: | ||||||||||
- condition: "${ .language == \"English\" }" | ||||||||||
transition: GreetInEnglish | ||||||||||
- condition: "${ .language == \"Spanish\" }" | ||||||||||
transition: GreetInSpanish | ||||||||||
defaultCondition: GreetInEnglish | ||||||||||
- name: GreetInEnglish | ||||||||||
type: inject | ||||||||||
data: | ||||||||||
greeting: "Hello from JSON Workflow, " | ||||||||||
transition: GreetPerson | ||||||||||
- name: GreetInSpanish | ||||||||||
type: inject | ||||||||||
data: | ||||||||||
greeting: "Saludos desde JSON Workflow, " | ||||||||||
transition: GreetPerson | ||||||||||
- name: GreetPerson | ||||||||||
type: operation | ||||||||||
actions: | ||||||||||
- name: greetAction | ||||||||||
functionRef: | ||||||||||
refName: greetFunction | ||||||||||
arguments: | ||||||||||
message: ".greeting + .name" | ||||||||||
end: true | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc login --token=<your_token> --server=<your_clusters_server_url> | ||||||||||
---- | ||||||||||
|
||||||||||
. Create a namespace in your cluster, by running the following command: | ||||||||||
+ | ||||||||||
<1> is a workflow_name | ||||||||||
<2> indicates that you must deploy the workflow in Dev mode | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc create namespace <namespace> | ||||||||||
---- | ||||||||||
|
||||||||||
. To deploy the application, apply the YAML file by entering the following command: | ||||||||||
. In your terminal, navigate to the root directory of your {ServerlessLogicProductName} project. | ||||||||||
|
||||||||||
. Deploy the application, by running the following command: | ||||||||||
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
|
||||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc apply -f <filename> -n <your_namespace> | ||||||||||
$ kn workflow deploy -n <namespace> | ||||||||||
---- | ||||||||||
|
||||||||||
. Verify the deployment and check the status of the deployed workflow by entering the following command: | ||||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc get workflow -n <your_namespace> -w | ||||||||||
$ oc get workflow -n <namespace> | ||||||||||
---- | ||||||||||
+ | ||||||||||
Ensure that your workflow is listed and the status is `Running` or `Completed`. | ||||||||||
|
@@ -89,7 +53,7 @@ Ensure that your workflow is listed and the status is `Running` or `Completed`. | |||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc edit sonataflow <workflow_name> -n <your_namespace> | ||||||||||
$ oc edit sonataflow <workflow_name> -n <namespace> | ||||||||||
---- | ||||||||||
|
||||||||||
. After editing, save the changes. The {ServerlessLogicOperatorName} detects the changes and updates the workflow accordingly. | ||||||||||
|
@@ -102,23 +66,48 @@ $ oc edit sonataflow <workflow_name> -n <your_namespace> | |||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc get sonataflows -n <your_namespace> | ||||||||||
$ oc get sonataflows -n <namespace> | ||||||||||
---- | ||||||||||
|
||||||||||
.. Find the pod of your application by running the following command: | ||||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc get pods -n <namespace> | ||||||||||
---- | ||||||||||
|
||||||||||
.. View the workflow logs by running the following command: | ||||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc logs <workflow_pod_name> -n <your_namespace> | ||||||||||
$ oc logs <workflow_pod_name> -n <namespace> | ||||||||||
---- | ||||||||||
|
||||||||||
.Testing | ||||||||||
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. Same thought re: non-standard heading for this Edit: I see now there already is a "Testing a deployment" procedure later in the assembly. Is that basically the same procedure that's being shown here? If so, could there just be an "Additional resources" link to that procedure from this one instead of duplicating? |
||||||||||
|
||||||||||
The {ServerlessLogicOperatorName} automatically generates a route for workflow deployments using the `dev` profile. To test your workflow, you can use management console that is accessible via the created route. The management console allows you execute the workflow and inspect executed the instances in detail. | ||||||||||
|
||||||||||
. Access the management console by excuting following steps: | ||||||||||
|
||||||||||
.. Retrieve the public URL to access the workflow service by running the following command: | ||||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc get route/<workflow_name> -n <namespace> | ||||||||||
---- | ||||||||||
+ | ||||||||||
Note the value of `HOST/PORT` from the result of tis command, referenced as `<WORKFLOW_URL>` in next step. | ||||||||||
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. Typo x2:
Suggested change
Also, if
Suggested change
If it has meaning as all-cap outside of this procedure, however (like in output or the UI someplace), then ignore. |
||||||||||
|
||||||||||
.. Navigate to the `<WORKFLOW_URL>/q/dev-ui/org.apache.kie.sonataflow.sonataflow-quarkus-devui/workflows` in your browser. Please note that it may take some time until the management console is available. | ||||||||||
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. Re: previous comment, match lowercase here as well, if you change the other:
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.
Suggested change
|
||||||||||
|
||||||||||
|
||||||||||
.Next steps | ||||||||||
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. This single-step |
||||||||||
|
||||||||||
. After completing the testing, delete the resources to avoid unnecessary usage by running the following command: | ||||||||||
+ | ||||||||||
[source,terminal] | ||||||||||
---- | ||||||||||
$ oc delete sonataflow <workflow_name> -n <your_namespace> | ||||||||||
$ kn workflow undeploy -n <namespace> | ||||||||||
---- | ||||||||||
|
||||||||||
|
||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,62 +13,22 @@ You can verify that your {ServerlessLogicProductName} workflow is running by per | |||||
* You have an {ServerlessLogicOperatorName} installed on your cluster. | ||||||
* You have access to an {ServerlessLogicProductName} project with the appropriate roles and permissions to create applications and other workloads in {ocp-product-title}. | ||||||
* You have installed the OpenShift CLI `(oc)`. | ||||||
* You have deployed your workflow in preview mode in the {ocp-product-title}. | ||||||
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. Drop "the":
Suggested change
|
||||||
|
||||||
.Procedure | ||||||
|
||||||
. Create a workflow `YAML` file similar to the following: | ||||||
. Retrieve the list of service and identify the one matching `name` of your workflow: | ||||||
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. Should this be plural?
Suggested change
|
||||||
+ | ||||||
[source,yaml] | ||||||
[source,terminal] | ||||||
---- | ||||||
apiVersion: sonataflow.org/v1alpha08 | ||||||
kind: SonataFlow | ||||||
metadata: | ||||||
name: greeting | ||||||
annotations: | ||||||
sonataflow.org/description: Greeting example on k8s! | ||||||
sonataflow.org/version: 0.0.1 | ||||||
spec: | ||||||
flow: | ||||||
start: ChooseOnLanguage | ||||||
functions: | ||||||
- name: greetFunction | ||||||
type: custom | ||||||
operation: sysout | ||||||
states: | ||||||
- name: ChooseOnLanguage | ||||||
type: switch | ||||||
dataConditions: | ||||||
- condition: "${ .language == \"English\" }" | ||||||
transition: GreetInEnglish | ||||||
- condition: "${ .language == \"Spanish\" }" | ||||||
transition: GreetInSpanish | ||||||
defaultCondition: GreetInEnglish | ||||||
- name: GreetInEnglish | ||||||
type: inject | ||||||
data: | ||||||
greeting: "Hello from JSON Workflow, " | ||||||
transition: GreetPerson | ||||||
- name: GreetInSpanish | ||||||
type: inject | ||||||
data: | ||||||
greeting: "Saludos desde JSON Workflow, " | ||||||
transition: GreetPerson | ||||||
- name: GreetPerson | ||||||
type: operation | ||||||
actions: | ||||||
- name: greetAction | ||||||
functionRef: | ||||||
refName: greetFunction | ||||||
arguments: | ||||||
message: ".greeting+.name" | ||||||
end: true | ||||||
$ oc get svc -n <namespace> | ||||||
---- | ||||||
|
||||||
. Create a route for the workflow service by running the following command: | ||||||
+ | ||||||
[source,terminal] | ||||||
---- | ||||||
$ oc expose svc/<workflow-service-name> -n workflows | ||||||
$ oc expose svc/<workflow-service-name> -n <namespace> | ||||||
---- | ||||||
+ | ||||||
This command creates a public URL to access the workflow service. | ||||||
|
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.
No colons for titles: