Skip to content

Commit 0537eaa

Browse files
committed
SRVLOGIC-469: Deploying workflows chapter does not use kn worklow plugin
Now it uses the kn workflow plugin
1 parent 9e303d6 commit 0537eaa

2 files changed

+35
-105
lines changed

modules/serverless-logic-building-deploying-workflow-preview-mode.adoc

+20-53
Original file line numberDiff line numberDiff line change
@@ -12,70 +12,28 @@ You can create a `SonataFlow` custom resource (CR) on {ocp-product-title} and {S
1212

1313
* You have an {ServerlessLogicOperatorName} installed on your cluster.
1414
* You have access to an {ServerlessLogicProductName} project with the appropriate roles and permissions to create applications and other workloads in {ocp-product-title}.
15+
* You have installed the {ServerlessLogicProductName} `kn-workflow` CLI plugin.
1516
* You have installed the OpenShift CLI `(oc)`.
1617
1718
.Procedure
1819

19-
. Create a workflow YAML file similar to the following:
20-
+
21-
[source,yaml]
22-
----
23-
apiVersion: sonataflow.org/v1alpha08
24-
kind: SonataFlow
25-
metadata:
26-
name: greeting
27-
annotations:
28-
sonataflow.org/description: Greeting example on k8s!
29-
sonataflow.org/version: 0.0.1
30-
spec:
31-
flow:
32-
start: ChooseOnLanguage
33-
functions:
34-
- name: greetFunction
35-
type: custom
36-
operation: sysout
37-
states:
38-
- name: ChooseOnLanguage
39-
type: switch
40-
dataConditions:
41-
- condition: "${ .language == \"English\" }"
42-
transition: GreetInEnglish
43-
- condition: "${ .language == \"Spanish\" }"
44-
transition: GreetInSpanish
45-
defaultCondition: GreetInEnglish
46-
- name: GreetInEnglish
47-
type: inject
48-
data:
49-
greeting: "Hello from JSON Workflow, "
50-
transition: GreetPerson
51-
- name: GreetInSpanish
52-
type: inject
53-
data:
54-
greeting: "Saludos desde JSON Workflow, "
55-
transition: GreetPerson
56-
- name: GreetPerson
57-
type: operation
58-
actions:
59-
- name: greetAction
60-
functionRef:
61-
refName: greetFunction
62-
arguments:
63-
message: ".greeting+.name"
64-
end: true
65-
----
66-
67-
. Apply the `SonataFlow` workflow definition to your {ocp-product-title} namespace by running the following command:
20+
. In your project application directory, execute the following command:
6821
+
6922
[source,terminal]
7023
----
71-
$ oc apply -f <workflow-name>.yaml -n <your_namespace>
24+
$ kn workflow gen-manifest --mode=preview --namespace <your_namespace>
7225
----
7326
+
74-
.Example command for the `greetings-workflow.yaml` file:
27+
This command generates {ocp-product-title} YAML manifests based on your `workflow.sw.json|yaml` definition. Default location is `<project_application_dir>/manifests` directory.
28+
You can modify these files to your liking, however when you run above command again, the changes are going to be overwritten. Use `--custom-generated-manifests-dir` or `-c` flag to generate the files in different location.
29+
30+
. Deploy the `SonataFlow` workflow application to your {ocp-product-title} namespace by running the following command:
31+
+
7532
[source,terminal]
7633
----
77-
$ oc apply -f greetings-workflow.yaml -n workflows
34+
$ kn workflow deploy --custom-manifests-dir=./manifests --namespace <your_namespace>
7835
----
36+
+
7937
8038
. List all the build configurations by running the following command:
8139
+
@@ -113,4 +71,13 @@ Ensure that the pod corresponding to your workflow is running.
11371
[source,terminal]
11472
----
11573
$ oc logs pod/<pod-name> -n workflows
116-
----
74+
----
75+
76+
.Cleanup
77+
. To cleanup the deployment, delete the projects resources running the following command:
78+
+
79+
[source,terminal]
80+
----
81+
$ kn workflow undeploy -n <your_namespace>
82+
----
83+
+

modules/serverless-logic-deploying-workflows-dev-mode.adoc

+15-52
Original file line numberDiff line numberDiff line change
@@ -12,69 +12,32 @@ You can deploy your local workflow on {ocp-product-title} in Dev mode. You can u
1212

1313
* You have {ServerlessLogicOperatorName} installed on your cluster.
1414
* You have access to a {ServerlessLogicProductName} project with the appropriate roles and permissions to create applications and other workloads in {ocp-product-title}.
15+
* You have installed the {ServerlessLogicProductName} `kn-workflow` CLI plugin.
1516
* You have installed the OpenShift CLI `(oc)`.
1617
1718
.Procedure
1819

19-
. Create the workflow configuration YAML file.
20+
. Login to your cluster
2021
+
21-
.Example `workflow-dev.yaml` file
22-
[source,yaml]
23-
----
24-
apiVersion: sonataflow.org/v1alpha08
25-
kind: SonataFlow
26-
metadata:
27-
name: greeting <1>
28-
annotations:
29-
sonataflow.org/description: Greeting example on k8s!
30-
sonataflow.org/version: 0.0.1
31-
sonataflow.org/profile: dev <2>
32-
spec:
33-
flow:
34-
start: ChooseOnLanguage
35-
functions:
36-
- name: greetFunction
37-
type: custom
38-
operation: sysout
39-
states:
40-
- name: ChooseOnLanguage
41-
type: switch
42-
dataConditions:
43-
- condition: "${ .language == \"English\" }"
44-
transition: GreetInEnglish
45-
- condition: "${ .language == \"Spanish\" }"
46-
transition: GreetInSpanish
47-
defaultCondition: GreetInEnglish
48-
- name: GreetInEnglish
49-
type: inject
50-
data:
51-
greeting: "Hello from JSON Workflow, "
52-
transition: GreetPerson
53-
- name: GreetInSpanish
54-
type: inject
55-
data:
56-
greeting: "Saludos desde JSON Workflow, "
57-
transition: GreetPerson
58-
- name: GreetPerson
59-
type: operation
60-
actions:
61-
- name: greetAction
62-
functionRef:
63-
refName: greetFunction
64-
arguments:
65-
message: ".greeting + .name"
66-
end: true
22+
[source,terminal]
23+
----
24+
$ oc login --token=<your_token> --server=<your_clusters_server_url>
6725
----
26+
27+
. Create a namespace in your cluster, by running the following command:
6828
+
69-
<1> is a workflow_name
70-
<2> indicates that you must deploy the workflow in Dev mode
29+
[source,terminal]
30+
----
31+
$ oc create namespace <your_namespace>
32+
----
7133

72-
. To deploy the application, apply the YAML file by entering the following command:
34+
. Deploy the application, by running the following command:
7335
+
7436
[source,terminal]
7537
----
76-
$ oc apply -f <filename> -n <your_namespace>
38+
$ kn workflow deploy --namespace <your_namespace>
7739
----
40+
+
7841
7942
. Verify the deployment and check the status of the deployed workflow by entering the following command:
8043
+
@@ -118,7 +81,7 @@ $ oc logs <workflow_pod_name> -n <your_namespace>
11881
+
11982
[source,terminal]
12083
----
121-
$ oc delete sonataflow <workflow_name> -n <your_namespace>
84+
$ kn workflow undeploy -n <your_namespace>
12285
----
12386

12487

0 commit comments

Comments
 (0)