Skip to content

Commit 5a2f678

Browse files
authored
Merge pull request #47093 from RichardHoch/state_only_mig_w_k8s_2
Description of state migration with Kubernetes resources (take 2)
2 parents 24c4819 + aeb8f43 commit 5a2f678

File tree

1 file changed

+48
-6
lines changed

1 file changed

+48
-6
lines changed

modules/migration-kubernetes-objects.adoc

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55

66
:_content-type: PROCEDURE
77
[id="migration-kubernetes-objects_{context}"]
8-
= Migrating Kubernetes objects
8+
= Performing a state migration of Kubernetes objects by using the {mtc-short} API
99

10-
You can perform a one-time migration of Kubernetes objects that constitute an application's state.
10+
After you migrate all the PV data, you can use the Migration Toolkit for Containers (MTC) API to perform a one-time state migration of Kubernetes objects that constitute an application.
11+
12+
You do this by configuring `MigPlan` custom resource (CR) fields to provide a list of Kubernetes resources with an additional label selector to further filter those resources, and then performing a migration by creating a `MigMigration` CR. The `MigPlan` resource is closed after the migration.
13+
14+
[NOTE]
15+
====
16+
Selecting Kubernetes resources is an API-only feature. You must update the `MigPlan` CR and create a `MigMigration` CR for it by using the CLI. The {mtc-short} web console does not support migrating Kubernetes objects.
17+
====
1118

1219
[NOTE]
1320
====
@@ -16,13 +23,32 @@ After migration, the `closed` parameter of the `MigPlan` CR is set to `true`. Yo
1623

1724
You add Kubernetes objects to the `MigPlan` CR by using one of the following options:
1825

19-
* Adding the Kubernetes objects to the `includedResources` section.
20-
* Using the `labelSelector` parameter to reference labeled Kubernetes objects.
21-
* 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`.
26+
* Adding the Kubernetes objects to the `includedResources` section. When the `includedResources` field is specified in the `MigPlan` CR, the plan takes a list of `group-kind` as input. Only resources present in the list are included in the migration.
27+
* Adding the optional `labelSelector` parameter to filter the `includedResources` in the `MigPlan`. When this field is specified, only resources matching the label selector are included in the migration. For example, you can filter a list of `Secret` and `ConfigMap` resources by using the label `app: frontend` as a filter.
2228
2329
.Procedure
2430

25-
* Update the `MigPlan` CR:
31+
. Update the `MigPlan` CR to include Kubernetes resources and, optionally, to filter the included resources by adding the `labelSelector` parameter:
32+
33+
.. To update the `MigPlan` CR to include Kubernetes resources:
34+
+
35+
[source,yaml]
36+
----
37+
apiVersion: migration.openshift.io/v1alpha1
38+
kind: MigPlan
39+
metadata:
40+
name: <migplan>
41+
namespace: openshift-migration
42+
spec:
43+
includedResources:
44+
- kind: <kind> <1>
45+
group: ""
46+
- kind: <kind>
47+
group: ""
48+
----
49+
<1> Specify the Kubernetes object, for example, `Secret` or `ConfigMap`.
50+
51+
.. Optional: To filter the included resources by adding the `labelSelector` parameter:
2652
+
2753
[source,yaml]
2854
----
@@ -44,3 +70,19 @@ spec:
4470
----
4571
<1> Specify the Kubernetes object, for example, `Secret` or `ConfigMap`.
4672
<2> Specify the label of the resources to migrate, for example, `app: frontend`.
73+
74+
. Create a `MigMigration` CR to migrate the selected Kubernetes resources. Verify that the correct `MigPlan` is referenced in `migPlanRef`:
75+
+
76+
[source,yaml]
77+
----
78+
apiVersion: migration.openshift.io/v1alpha1
79+
kind: MigMigration
80+
metadata:
81+
generateName: <migplan>
82+
namespace: openshift-migration
83+
spec:
84+
migPlanRef:
85+
name: <migplan>
86+
namespace: openshift-migration
87+
stage: false
88+
----

0 commit comments

Comments
 (0)