Skip to content

Commit ee85bb8

Browse files
authored
SRVLOGIC-774: Operator, DI, JS and Workflows migration from OSL 1.37.2 to OSL 1.38.0 (#135)
1 parent 9ea8aba commit ee85bb8

4 files changed

Lines changed: 230 additions & 1 deletion

File tree

modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
****** xref:serverless-logic:cloud/operator/upgrade-serverless-operator/upgrade_1_36_0_to_1_37_0.adoc[OSL 1.36.0 to 1.37.0]
9696
****** xref:serverless-logic:cloud/operator/upgrade-serverless-operator/upgrade_1_37_0_to_1_37_1.adoc[OSL 1.37.0 to 1.37.1]
9797
****** xref:serverless-logic:cloud/operator/upgrade-serverless-operator/upgrade_1_37_1_to_1_37_2.adoc[OSL 1.37.1 to 1.37.2]
98+
****** xref:serverless-logic:cloud/operator/upgrade-serverless-operator/upgrade_1_37_2_to_1_38_0.adoc[OSL 1.37.2 to 1.38.0]
9899
***** xref:serverless-logic:cloud/operator/global-configuration.adoc[Admin Configuration]
99100
***** xref:serverless-logic:cloud/operator/developing-workflows.adoc[Development Mode]
100101
***** xref:serverless-logic:cloud/operator/referencing-resource-files.adoc[Referencing Workflow Resources]
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// Regular procedure for gitops workflows migration that requires (or the user optionally wants) a rebuild of the workflow image.
2+
// The caller document must set the following attributes: (see: upgrade_1_37_0_to_1_37_1.adoc as example)
3+
// current_operator_version, next_operator_version and next_swf_builder_image.
4+
:page-partial:
5+
6+
*Pre-operator upgrade steps:*
7+
8+
. If the workflow is configured to use persistence, you must back up the workflow database.
9+
Ensure that your database backup includes all database objects, not just the table's information.
10+
11+
+
12+
. Ensure that you have a copy of the corresponding `SonataFlow` CR, as well as any other Kubernetes resources created for that workflow.
13+
For example, if you are using custom property configurations, you will need a copy of the user-provided `ConfigMap` with the `application.properties` file.
14+
15+
+
16+
. Delete the workflow by using the following command:
17+
18+
+
19+
[source,terminal]
20+
----
21+
$ oc delete -f <my-workflow.yaml> -n <target_namespace>
22+
----
23+
24+
*Post-operator upgrade steps:*
25+
26+
[start=4]
27+
. Rebuild the workflow image using the new {product_name} `{next_operator_version}` workflow builder `{next_swf_builder_image}`, by considering the following:
28+
29+
+
30+
By default, the {operator_name} generates a workflow `Deployment` with the `imagePullPolicy: IfNotPresent`.
31+
Meaning that, if an already deployed workflow `my-wofklow`, is redeployed with the same image name, even when that image was rebuild, the old already downloaded image will be picked-up.
32+
+
33+
To ensure the new image is picked-up you can:
34+
35+
* Use a new tag, and configure the workflow with it.
36+
+
37+
[source,yaml]
38+
----
39+
current image: quay.io/my-images/my-workflow:1.0
40+
new image: quay.io/my-images/my-workflow:1.0-1
41+
----
42+
+
43+
[source,yaml]
44+
----
45+
apiVersion: sonataflow.org/v1alpha08
46+
kind: SonataFlow
47+
metadata:
48+
name: my-workflow
49+
annotations:
50+
sonataflow.org/description: My Workflow
51+
sonataflow.org/version: '1.0'
52+
sonataflow.org/profile: gitops
53+
spec:
54+
podTemplate:
55+
container:
56+
# only change the image name/tag
57+
image: quay.io/my-images/my-workflow:1.0-1
58+
flow:
59+
# the workflow definition (don't change)
60+
----
61+
+
62+
* Preserve the image name, and configure the workflow with the `imagePullPolicy: Always`.
63+
+
64+
[source,yaml]
65+
----
66+
apiVersion: sonataflow.org/v1alpha08
67+
kind: SonataFlow
68+
metadata:
69+
name: my-workflow
70+
annotations:
71+
sonataflow.org/description: My Workflow
72+
sonataflow.org/version: '1.0'
73+
sonataflow.org/profile: gitops
74+
spec:
75+
podTemplate:
76+
container:
77+
image: quay.io/my-images/my-workflow:1.0
78+
# only change the imagePullStrategy
79+
imagePullPolicy: Always
80+
flow:
81+
# the workflow definition (don't change).
82+
----
83+
+
84+
[IMPORTANT]
85+
====
86+
In any of the alternatives, when you rebuild the image (in your local environment), and when you redeploy the workflow (using the `SonataFlow` CR), you must not change
87+
the workflow definition, nor any workflow related assets. This includes the name, version, and description.
88+
====
89+
90+
. Ensure that any Kubernetes resource for that workflow, such as the user-provided `ConfigMap` with `application.properties`, is created before you redeploy the workflow.
91+
92+
+
93+
. Redeploy the workflow by using the following command.
94+
+
95+
[source,terminal]
96+
----
97+
$ oc apply -f <my-workflow.yaml> -n <target_namespace>
98+
----

modules/serverless-logic/pages/_common-content/cloud/operator/upgrade-serverless-operator/regular_operator_upgrade_procedure.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// current_operator_version, next_operator_version
44
:page-partial:
55

6-
+
76
. Execute the following command to query the available installation plan for the Operator upgrade to `{next_operator_version}`:
87
+
98
[source,bash]
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// NOTE: Do not externally parametrize these versions, they are specific to this migration guide.
2+
:current_operator_version: 1.37.2
3+
:next_operator_version: 1.38.0
4+
:next_swf_builder_image: registry.redhat.io/openshift-serverless-1/logic-swf-builder-rhel9:1.38.0
5+
6+
= Upgrade {operator_name} from {current_operator_version} to {next_operator_version}
7+
:compat-mode!:
8+
// Metadata:
9+
:description: Upgrade OSL Operator from 1.37.2 to 1.38.0
10+
:keywords: kogito, sonataflow, workflow, serverless, operator, kubernetes, minikube, openshift, containers
11+
// links
12+
:openshift_operator_install_url: https://docs.openshift.com/container-platform/4.13/operators/admin/olm-adding-operators-to-cluster.html
13+
:openshift_operator_uninstall_url: https://docs.openshift.com/container-platform/4.13/operators/admin/olm-deleting-operators-from-cluster.html
14+
:kubernetes_operator_install_url: https://operatorhub.io/how-to-install-an-operator
15+
:kubernetes_operator_uninstall_url: https://olm.operatorframework.io/docs/tasks/uninstall-operator/
16+
:operatorhub_url: https://operatorhub.io/
17+
18+
This guide describes how to upgrade the {operator_name} `{current_operator_version}` installed in an OpenShift cluster to the version `{next_operator_version}`.
19+
20+
.Prerequisites
21+
* An OpenShift cluster with admin privileges and `oc` installed.
22+
23+
== Procedure
24+
25+
To upgrade an {operator_name} `{current_operator_version}` installation to the version `{next_operator_version}`, you must execute this procedure:
26+
27+
=== Overall upgrade procedure
28+
29+
It is recommended to read and understand all the steps of the procedure before executing.
30+
Interested parties might automate the procedure according to their convenience or infrastructure, for example, keeping all the `SonataFlow` CRs in a GitHub repository, might help considerably to implement automation, etc.
31+
32+
. Increase the Job Service retry interval before starting the upgrade by following these <<config_jobs_service_retry_interval, steps>>.
33+
. Execute the steps `1` and `2` of the upgrade for every workflow with the <<workflows_dev_profile, dev profile>>.
34+
. Execute the steps `1`, `2` and `3` of the upgrade for every workflow with the <<workflows_preview_profile, preview profile>>.
35+
. Execute the steps `1`, `2`, `3` and `4` of the upgrade for every workflow with the <<workflows_gitops_profile_image_rebuild, gitops profile>>.
36+
. Execute the step `1` of the <<data_index_upgrade, Data Index>> upgrade.
37+
. Execute the step `1` of the <<jobs_service_upgrade, Job Service>> upgrade.
38+
. Upgrade the {operator_name} to the version `{next_operator_version}` <<operator_upgrade_procedure, following this procedure>>, and verify that the new version is running.
39+
. Finalize the <<data_index_upgrade, Data Index>> upgrade by continuing from step `2`.
40+
. Finalize the <<jobs_service_upgrade, Job Service>> upgrade by continuing from step `2`.
41+
. Finalize the upgrade for the workflows with the <<workflows_gitops_profile_image_rebuild, gitops profile>> by continuing from step `5`.
42+
. Finalize the upgrade for the workflows with the <<workflows_preview_profile, preview profile>> by continuing from step `4`.
43+
. Finalize the upgrade for the workflows with the <<workflows_dev_profile, dev profile>> by continuing from step `3`.
44+
. Restore the Job Service retry interval by following these <<restore_jobs_service_retry_interval, steps>>.
45+
46+
[#config_jobs_service_retry_interval]
47+
==== Increase the Jobs Service retry interval
48+
49+
include::../../../_common-content/cloud/operator/upgrade-serverless-operator/regular_jobs_service_increase_retry_interval_procedure.adoc[]
50+
51+
[#workflows_dev_profile]
52+
==== Workflows with the `dev` profile
53+
54+
include::../../../_common-content/cloud/operator/upgrade-serverless-operator/regular_dev_workflow_upgrade_procedure.adoc[]
55+
56+
[#workflows_preview_profile]
57+
==== Workflows with the `preview` profile
58+
59+
include::../../../_common-content/cloud/operator/upgrade-serverless-operator/regular_preview_workflow_upgrade_procedure.adoc[]
60+
61+
[#workflows_gitops_profile_image_rebuild]
62+
==== Workflows with the `gitops` profile
63+
64+
For every workflow with the `gitops` profile, it is strongly recommended to rebuild the workflow image generated for version `{current_operator_version}` before applying the upgrade, to ensure full compatibility with OpenShift Serverless Logic `{next_operator_version}`.
65+
66+
For every workflow my-workflow with the `gitops` profile you must:
67+
68+
include::../../../_common-content/cloud/operator/upgrade-serverless-operator/regular_gitops_worklow_upgrade_procedure_with_image_build.adoc[]
69+
70+
[#data_index_upgrade]
71+
==== Data Index upgrade
72+
73+
Every Data Index deployment must be upgraded with the following procedure:
74+
75+
*Pre-operator upgrade steps:*
76+
77+
. Back up the Data Index database, including all database objects, not just the table information.
78+
79+
*Post-operator upgrade steps:*
80+
81+
[start=2]
82+
. The Data Index service will be automatically restarted with the version {next_operator_version}.
83+
84+
85+
[#jobs_service_upgrade]
86+
==== Job Service upgrade
87+
88+
*Pre-operator upgrade steps:*
89+
90+
. Back up the Job Service database, including all database objects, not just the table information.
91+
92+
*Post-operator upgrade steps:*
93+
94+
[start=2]
95+
96+
. The Job Service will be automatically restarted with the version {next_operator_version}.
97+
98+
[#operator_upgrade_procedure]
99+
==== Operator Upgrade Procedure
100+
To upgrade the {operator_name} from `{current_operator_version}` to `{next_operator_version}` you must execute these steps:
101+
102+
include::../../../_common-content/cloud/operator/upgrade-serverless-operator/regular_operator_upgrade_procedure.adoc[]
103+
104+
. Verify that a new Data Index and Jobs Service database initialization `Job` was created:
105+
+
106+
Alternatively, in every namespace where you have installed a `SonataFlowPlatform`, that has configured the `dbMigrationStrategy: job`, for any of
107+
the Data Index or the Jobs Service, you can verify that a new `sonataflow-db-migrator-job` was created with the following command:
108+
109+
+
110+
[source,bash,subs="attributes"]
111+
----
112+
kubectl get jobs \
113+
-n &lt;target-namespace&gt; \
114+
-l app=&lt;platform-name&gt;,app.kubernetes.io/version={next_operator_version}
115+
----
116+
117+
+
118+
You must get an output similar to this:
119+
+
120+
[source, terminal]
121+
----
122+
NAME STATUS COMPLETIONS DURATION AGE
123+
sonataflow-db-migrator-job-b81d6bb3 Complete 1/1 15s 16m
124+
----
125+
126+
[#restore_jobs_service_retry_interval]
127+
==== Restore the Jobs Service retry interval
128+
129+
include::../../../_common-content/cloud/operator/upgrade-serverless-operator/regular_jobs_service_restore_retry_interval_procedure.adoc[]
130+
131+
include::../../../../pages/_common-content/report-issue.adoc[]

0 commit comments

Comments
 (0)