Skip to content

Commit 95739be

Browse files
authored
Merge pull request #37742 from apinnick/bz2015590-state-migration-corrections
BZ2015590: Fixing and reorganizing state migration
2 parents 2ffcc46 + e771c32 commit 95739be

9 files changed

+132
-136
lines changed

migrating_from_ocp_3_to_4/about-mtc-3-4.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ The service catalog is deprecated in {product-title} 4. You can migrate workload
2323
include::modules/migration-terminology.adoc[leveloffset=+1]
2424
include::modules/migration-mtc-workflow.adoc[leveloffset=+1]
2525
include::modules/migration-understanding-data-copy-methods.adoc[leveloffset=+1]
26-
include::modules/migration-about-state-migration.adoc[leveloffset=+1]

migrating_from_ocp_3_to_4/advanced-migration-options-3-4.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ include::modules/migration-prerequisites.adoc[leveloffset=+2]
1919
include::modules/migration-creating-registry-route-for-dim.adoc[leveloffset=+2]
2020
include::modules/migration-configuring-proxies.adoc[leveloffset=+2]
2121
include::modules/migration-migrating-applications-api.adoc[leveloffset=+2]
22-
include::modules/migration-state-migration-cli.adoc[leveloffset=+2]
22+
23+
include::modules/migration-state-migration-cli.adoc[leveloffset=+1]
24+
include::modules/migration-excluding-pvcs.adoc[leveloffset=+2]
25+
include::modules/migration-mapping-pvcs.adoc[leveloffset=+2]
26+
include::modules/migration-kubernetes-objects.adoc[leveloffset=+2]
2327

2428
include::modules/migration-hooks.adoc[leveloffset=+1]
2529
include::modules/migration-writing-ansible-playbook-hook.adoc[leveloffset=+2]

migration_toolkit_for_containers/about-mtc.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ See xref:../migration_toolkit_for_containers/advanced-migration-options-mtc.adoc
2121
include::modules/migration-terminology.adoc[leveloffset=+1]
2222
include::modules/migration-mtc-workflow.adoc[leveloffset=+1]
2323
include::modules/migration-understanding-data-copy-methods.adoc[leveloffset=+1]
24-
include::modules/migration-about-state-migration.adoc[leveloffset=+1]

migration_toolkit_for_containers/advanced-migration-options-mtc.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ include::modules/migration-creating-registry-route-for-dim.adoc[leveloffset=+2]
1919
include::modules/migration-configuring-proxies.adoc[leveloffset=+2]
2020
include::modules/migration-migrating-applications-api.adoc[leveloffset=+2]
2121
include::modules/migration-mapping-destination-namespaces-in-the-migplan-cr.adoc[leveloffset=+2]
22-
include::modules/migration-state-migration-cli.adoc[leveloffset=+2]
22+
23+
include::modules/migration-state-migration-cli.adoc[leveloffset=+1]
24+
include::modules/migration-excluding-pvcs.adoc[leveloffset=+2]
25+
include::modules/migration-mapping-pvcs.adoc[leveloffset=+2]
26+
include::modules/migration-kubernetes-objects.adoc[leveloffset=+2]
2327

2428
include::modules/migration-hooks.adoc[leveloffset=+1]
2529
include::modules/migration-writing-ansible-playbook-hook.adoc[leveloffset=+2]

modules/migration-about-state-migration.adoc

Lines changed: 0 additions & 20 deletions
This file was deleted.

modules/migration-excluding-pvcs.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * migrating_from_ocp_3_to_4/advanced-migration-options-3-4.adoc
4+
// * migration_toolkit_for_containers/advanced-migration-options-mtc.adoc
5+
6+
[id="migration-excluding-pvcs_{context}"]
7+
= Excluding persistent volume claims
8+
9+
You select persistent volume claims (PVCs) for state migration by excluding the PVCs that you do not want to migrate. You exclude PVCs by setting the `spec.persistentVolumes.pvc.selection.action` parameter of the `MigPlan` custom resource (CR) after the persistent volumes (PVs) have been discovered.
10+
11+
.Prerequisites
12+
13+
* `MigPlan` CR with discovered PVs.
14+
15+
.Procedure
16+
17+
* Add the `spec.persistentVolumes.pvc.selection.action` parameter to the `MigPlan` CR and set it to `skip`:
18+
+
19+
[source,yaml]
20+
----
21+
apiVersion: migration.openshift.io/v1alpha1
22+
kind: MigPlan
23+
metadata:
24+
name: <migplan>
25+
namespace: openshift-migration
26+
spec:
27+
...
28+
persistentVolumes:
29+
- capacity: 10Gi
30+
name: <pv_name>
31+
pvc:
32+
...
33+
selection:
34+
action: skip
35+
----
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * migrating_from_ocp_3_to_4/advanced-migration-options-3-4.adoc
4+
// * migration_toolkit_for_containers/advanced-migration-options-mtc.adoc
5+
6+
[id="migration-kubernetes-objects_{context}"]
7+
= Migrating Kubernetes objects
8+
9+
You can perform a one-time migration of Kubernetes objects that constitute an application's state.
10+
11+
[NOTE]
12+
====
13+
After migration, the `closed` parameter of the `MigPlan` CR is set to `true`. You cannot create another `MigMigration` CR for this `MigPlan` CR.
14+
====
15+
16+
You add Kubernetes objects to the `MigPlan` CR by using one of the following options:
17+
18+
* Adding the Kubernetes objects to the `includedResources` section.
19+
* Using the `labelSelector` parameter to reference labeled Kubernetes objects.
20+
* Adding Kubernetes objects to the `includedResources` section and then filtering them with the `labelSelector` parameter, for example, `Secret` and `ConfigMap` resources with the label `app: frontend`.
21+
22+
.Procedure
23+
24+
* Update the `MigPlan` CR:
25+
+
26+
[source,yaml]
27+
----
28+
apiVersion: migration.openshift.io/v1alpha1
29+
kind: MigPlan
30+
metadata:
31+
name: <migplan>
32+
namespace: openshift-migration
33+
spec:
34+
includedResources: <1>
35+
- kind: <Secret>
36+
group: ""
37+
- kind: <ConfigMap>
38+
group: ""
39+
...
40+
labelSelector:
41+
matchLabels:
42+
<app: frontend> <2>
43+
----
44+
<1> Specify the `kind` and `group` of each resource.
45+
<2> Specify the label of the resources to migrate.

modules/migration-mapping-pvcs.adoc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * migrating_from_ocp_3_to_4/advanced-migration-options-3-4.adoc
4+
// * migration_toolkit_for_containers/advanced-migration-options-mtc.adoc
5+
6+
[id="migration-mapping-pvcs_{context}"]
7+
= Mapping persistent volume claims
8+
9+
You can migrate PV data from the source cluster to PVCs that are already provisioned in the target cluster by mapping PVCs in the `MigPlan` CR. This ensures that the target PVCs of migrated applications are synchronized with the source PVCs.
10+
11+
You map persistent volume claims (PVCs) by updating the `spec.persistentVolumes.pvc.name` parameter in the `MigPlan` custom resource (CR) after the persistent volumes (PVs) have been discovered.
12+
13+
.Prerequisites
14+
15+
* `MigPlan` CR with discovered PVs.
16+
17+
.Procedure
18+
19+
* Update the `spec.persistentVolumes.pvc.name` parameter in the `MigPlan` CR:
20+
+
21+
[source,yaml]
22+
----
23+
apiVersion: migration.openshift.io/v1alpha1
24+
kind: MigPlan
25+
metadata:
26+
name: <migplan>
27+
namespace: openshift-migration
28+
spec:
29+
...
30+
persistentVolumes:
31+
- capacity: 10Gi
32+
name: <pv_name>
33+
pvc:
34+
name: <source_pvc>:<destination_pvc> <1>
35+
----
36+
<1> Specify the PVC on the source cluster and the PVC on the destination cluster. If the destination PVC does not exist, it will be created. You can use this mapping to change the PVC name during migration.

modules/migration-state-migration-cli.adoc

Lines changed: 6 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -4,123 +4,17 @@
44
// * migration_toolkit_for_containers/advanced-migration-options-mtc.adoc
55

66
[id="migration-state-migration-cli_{context}"]
7-
= Migrating an application's state
7+
= State migration
88

9-
You can perform repeatable, state-only migrations by selecting specific persistent volume claims (PVCs). During a state migration, {mtc-full} ({mtc-short}) copies persistent volume (PV) data to the target cluster. PV references are not moved. The application pods continue to run on the source cluster.
9+
You can perform repeatable, state-only migrations by using {mtc-full} ({mtc-short}) to migrate persistent volume claims (PVCs) that constitute an application's state. Persistent volume (PV) data is copied to the target cluster. The PV references are not moved. The application pods continue to run on the source cluster.
10+
11+
You can perform a one-time migration of Kubernetes objects that constitute an application's state.
1012

1113
If you have a CI/CD pipeline, you can migrate stateless components by deploying them on the target cluster. Then you can migrate stateful components by using {mtc-short}.
1214

13-
You can use state migration to migrate namespaces within the same cluster.
15+
You can perform a state migration between clusters or within the same cluster.
1416

1517
[IMPORTANT]
1618
====
17-
Do not use state migration to migrate namespaces between clusters. Use stage or cutover migration instead.
19+
State migration migrates only the components that constitute an application's state. If you want to migrate an entire namespace, use stage or cutover migration.
1820
====
19-
20-
You can migrate PV data from the source cluster to PVCs that are already provisioned in the target cluster by mapping PVCs in the `MigPlan` CR. This ensures that the target PVCs of migrated applications are synchronized with the source PVCs.
21-
22-
You can perform a one-time migration of Kubernetes objects that store application state.
23-
24-
[id="excluding-pvcs_{context}"]
25-
== Excluding persistent volume claims
26-
27-
You can exclude persistent volume claims (PVCs) by adding the `spec.persistentVolumes.pvc.selection.action` parameter to the `MigPlan` custom resource (CR) after the persistent volumes (PVs) have been discovered.
28-
29-
.Prerequisites
30-
31-
* `MigPlan` CR with discovered PVs.
32-
33-
.Procedure
34-
35-
* Add the `spec.persistentVolumes.pvc.selection.action` parameter to the `MigPlan` CR and set its value to `skip`:
36-
+
37-
[source,yaml]
38-
----
39-
apiVersion: migration.openshift.io/v1alpha1
40-
kind: MigPlan
41-
metadata:
42-
name: <migplan>
43-
namespace: openshift-migration
44-
spec:
45-
...
46-
persistentVolumes:
47-
- capacity: 10Gi
48-
name: <pv_name>
49-
pvc:
50-
...
51-
selection:
52-
action: skip <1>
53-
----
54-
<1> `skip` excludes the PVC from the migration plan.
55-
56-
[id="mapping-pvcs_{context}"]
57-
== Mapping persistent volume claims
58-
59-
You can map persistent volume claims (PVCs) by updating the `spec.persistentVolumes.pvc.name` parameter in the `MigPlan` custom resource (CR) after the persistent volumes (PVs) have been discovered.
60-
61-
.Prerequisites
62-
63-
* `MigPlan` CR with discovered PVs.
64-
65-
.Procedure
66-
67-
* Update the `spec.persistentVolumes.pvc.name` parameter in the `MigPlan` CR:
68-
+
69-
[source,yaml]
70-
----
71-
apiVersion: migration.openshift.io/v1alpha1
72-
kind: MigPlan
73-
metadata:
74-
name: <migplan>
75-
namespace: openshift-migration
76-
spec:
77-
...
78-
persistentVolumes:
79-
- capacity: 10Gi
80-
name: <pv_name>
81-
pvc:
82-
name: <source_pvc>:<destination_pvc> <1>
83-
----
84-
<1> Specify the PVC on the source cluster and the PVC on the destination cluster. If the destination PVC does not exist, it will be created. You can use this mapping to change the PVC name during migration.
85-
86-
[id="migrating-kubernetes-objects_{context}"]
87-
== Migrating Kubernetes objects
88-
89-
You can perform a one-time migration of Kubernetes objects that constitute an application's state.
90-
91-
[NOTE]
92-
====
93-
After migration, the `closed` parameter of the `MigPlan` CR is set to `true`. You cannot create another `MigMigration` CR for this `MigPlan` CR.
94-
====
95-
96-
You add Kubernetes objects to the `MigPlan` CR by using the following options:
97-
98-
* Adding the Kubernetes objects to the `includedResources` section.
99-
* Using the `labelSelector` parameter to reference labeled Kubernetes objects.
100-
101-
If you set both parameters, the label is used to filter the included resources, for example, to migrate `Secret` and `ConfigMap` resources with the label `app: frontend`.
102-
103-
.Procedure
104-
105-
* Update the `MigPlan` CR:
106-
+
107-
[source,yaml]
108-
----
109-
apiVersion: migration.openshift.io/v1alpha1
110-
kind: MigPlan
111-
metadata:
112-
name: <migplan>
113-
namespace: openshift-migration
114-
spec:
115-
includedResources: <1>
116-
- kind: <Secret>
117-
group: ""
118-
- kind: <ConfigMap>
119-
group: ""
120-
...
121-
labelSelector:
122-
matchLabels:
123-
<app: frontend> <2>
124-
----
125-
<1> Specify the `kind` and `group` of each resource.
126-
<2> Specify the label of the resources to migrate.

0 commit comments

Comments
 (0)