From 0bf1876cde2ceacbaeeca40d74eb33edf4413ace Mon Sep 17 00:00:00 2001 From: Avital Pinnick Date: Wed, 28 Jul 2021 17:13:55 +0300 Subject: [PATCH] BZ1964901: Manually rolling back migration, uninstalling --- .../troubleshooting-3-4.adoc | 16 +++- .../troubleshooting-mtc.adoc | 16 +++- .../migration-rolling-back-migration-cli.adoc | 6 +- ...ation-rolling-back-migration-manually.adoc | 58 +++++++++++ ...on-rolling-back-migration-web-console.adoc | 10 +- .../migration-uninstalling-mtc-clean-up.adoc | 95 +++++++++++++++++++ 6 files changed, 189 insertions(+), 12 deletions(-) create mode 100644 modules/migration-rolling-back-migration-manually.adoc create mode 100644 modules/migration-uninstalling-mtc-clean-up.adoc diff --git a/migrating_from_ocp_3_to_4/troubleshooting-3-4.adoc b/migrating_from_ocp_3_to_4/troubleshooting-3-4.adoc index 584324569e..dbcb27399c 100644 --- a/migrating_from_ocp_3_to_4/troubleshooting-3-4.adoc +++ b/migrating_from_ocp_3_to_4/troubleshooting-3-4.adoc @@ -2,6 +2,7 @@ = Troubleshooting include::modules/common-attributes.adoc[] :context: troubleshooting-3-4 +:troubleshooting-3-4: toc::[] @@ -22,8 +23,8 @@ include::modules/migration-debugging-velero-resources.adoc[leveloffset=+2] include::modules/migration-partial-failure-velero.adoc[leveloffset=+2] include::modules/migration-using-mtc-crs-for-troubleshooting.adoc[leveloffset=+2] -[discrete] [id="additional-resources-for-debugging-tools_{context}"] +[discrete] === Additional resources for debugging tools * xref:../migrating_from_ocp_3_to_4/about-mtc-3-4.adoc#migration-mtc-workflow_about-mtc-3-4[{mtc-short} workflow] @@ -44,5 +45,18 @@ include::modules/migration-known-issues.adoc[leveloffset=+2] You can roll back a migration by using the {mtc-short} web console or the CLI. +You can also xref:../migrating_from_ocp_3_to_4/troubleshooting-3-4.adoc#migration-rolling-back-migration-manually_troubleshooting-3-4[roll back a migration manually]. + include::modules/migration-rolling-back-migration-web-console.adoc[leveloffset=+2] include::modules/migration-rolling-back-migration-cli.adoc[leveloffset=+2] +include::modules/migration-rolling-back-migration-manually.adoc[leveloffset=+2] + +include::modules/migration-uninstalling-mtc-clean-up.adoc[leveloffset=+1] + +[id="additional-resources-uninstalling_{context}"] +[discrete] +=== Additional resources for uninstalling {mtc-short} + +* xref:../operators/admin/olm-deleting-operators-from-cluster.adoc#olm-deleting-operators-from-a-cluster-using-web-console_olm-deleting-operators-from-cluster[Deleting Operators from a cluster using the web console] + +:troubleshooting-3-4!: diff --git a/migration_toolkit_for_containers/troubleshooting-mtc.adoc b/migration_toolkit_for_containers/troubleshooting-mtc.adoc index 7ac48b2cdd..03dc18d550 100644 --- a/migration_toolkit_for_containers/troubleshooting-mtc.adoc +++ b/migration_toolkit_for_containers/troubleshooting-mtc.adoc @@ -2,6 +2,7 @@ = Troubleshooting include::modules/common-attributes.adoc[] :context: troubleshooting-mtc +:troubleshooting-mtc: toc::[] @@ -22,8 +23,8 @@ include::modules/migration-debugging-velero-resources.adoc[leveloffset=+2] include::modules/migration-partial-failure-velero.adoc[leveloffset=+2] include::modules/migration-using-mtc-crs-for-troubleshooting.adoc[leveloffset=+2] -[discrete] [id="additional-resources-for-debugging-tools_{context}"] +[discrete] === Additional resources for debugging tools * xref:../migration_toolkit_for_containers/about-mtc.adoc#migration-mtc-workflow_about-mtc[{mtc-short} workflow] @@ -42,5 +43,18 @@ include::modules/migration-error-messages.adoc[leveloffset=+2] You can roll back a migration by using the {mtc-short} web console or the CLI. +You can also xref:../migration_toolkit_for_containers/troubleshooting-mtc.adoc#migration-rolling-back-migration-manually_troubleshooting-mtc[roll back a migration manually]. + include::modules/migration-rolling-back-migration-web-console.adoc[leveloffset=+2] include::modules/migration-rolling-back-migration-cli.adoc[leveloffset=+2] +include::modules/migration-rolling-back-migration-manually.adoc[leveloffset=+2] + +include::modules/migration-uninstalling-mtc-clean-up.adoc[leveloffset=+1] + +[id="additional-resources-uninstalling_{context}"] +[discrete] +=== Additional resources for uninstalling {mtc-short} + +* xref:../operators/admin/olm-deleting-operators-from-cluster.adoc#olm-deleting-operators-from-a-cluster-using-web-console_olm-deleting-operators-from-cluster[Deleting Operators from a cluster using the web console] + +:troubleshooting-mtc!: diff --git a/modules/migration-rolling-back-migration-cli.adoc b/modules/migration-rolling-back-migration-cli.adoc index 70448c3edd..a76de6884b 100644 --- a/modules/migration-rolling-back-migration-cli.adoc +++ b/modules/migration-rolling-back-migration-cli.adoc @@ -10,15 +10,13 @@ You can roll back a migration by creating a `MigMigration` custom resource (CR) [NOTE] ==== -If you roll back a failed direct volume migration, the following resources are preserved in the namespaces specified in the `MigPlan` custom resource (CR) to help you debug the failed migration: +The following resources remain in the migrated namespaces for debugging after a failed direct volume migration (DVM): * Config maps (source and destination clusters) * `Secret` CRs (source and destination clusters) * `Rsync` CRs (source cluster) -* `Service` CRs (destination cluster) -* `Route` CRs (destination cluster) -These resources must be deleted manually. +These resources do not affect rollback. You can delete them manually. If you later run the same migration plan successfully, the resources from the failed migration are deleted automatically. ==== diff --git a/modules/migration-rolling-back-migration-manually.adoc b/modules/migration-rolling-back-migration-manually.adoc new file mode 100644 index 0000000000..1f4ed0db36 --- /dev/null +++ b/modules/migration-rolling-back-migration-manually.adoc @@ -0,0 +1,58 @@ +// Module included in the following assemblies: +// +// * migrating_from_ocp_3_to_4/troubleshooting-3-4.adoc +// * migration_toolkit_for_containers/troubleshooting-mtc + +[id="migration-rolling-back-migration-manually_{context}"] += Rolling back a migration manually + +You can roll back a failed migration manually by deleting the `stage` pods and unquiescing the application. + +If you run the same migration plan successfully, the resources from the failed migration are deleted automatically. + +[NOTE] +==== +The following resources remain in the migrated namespaces after a failed direct volume migration (DVM): + +* Config maps (source and destination clusters) +* `Secret` CRs (source and destination clusters) +* `Rsync` CRs (source cluster) + +These resources do not affect rollback. You can delete them manually. +==== + +.Procedure + +. Delete the `stage` pods on all clusters: ++ +[source,terminal] +---- +$ oc delete $(oc get pods -l migration.openshift.io/is-stage-pod -n ) <1> +---- +<1> Namespaces specified in the `MigPlan` CR. + +. Unquiesce the application on the source cluster by scaling the replicas to their premigration number: ++ +[source,terminal] +---- +$ oc scale deployment --replicas= +---- ++ +The `migration.openshift.io/preQuiesceReplicas` annotation in the `Deployment` CR displays the premigration number of replicas: ++ +[source,yaml] +---- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "1" + migration.openshift.io/preQuiesceReplicas: "1" +---- + +. Verify that the application pods are running on the source cluster: ++ +[source,terminal] +---- +$ oc get pod -n +---- diff --git a/modules/migration-rolling-back-migration-web-console.adoc b/modules/migration-rolling-back-migration-web-console.adoc index 440a1daa2d..c7a443c294 100644 --- a/modules/migration-rolling-back-migration-web-console.adoc +++ b/modules/migration-rolling-back-migration-web-console.adoc @@ -10,15 +10,13 @@ You can roll back a migration by using the {mtc-full} ({mtc-short}) web console. [NOTE] ==== -If you roll back a failed direct volume migration, the following resources are preserved in the namespaces specified in the migration plan to help you debug the failed migration: +The following resources remain in the migrated namespaces for debugging after a failed direct volume migration (DVM): -* Config maps (source and target clusters) -* `Secret` CRs (source and target clusters) +* Config maps (source and destination clusters) +* `Secret` CRs (source and destination clusters) * `Rsync` CRs (source cluster) -* `Service` CRs (target cluster) -* `Route` CRs (target cluster) -These resources must be deleted manually. +These resources do not affect rollback. You can delete them manually. If you later run the same migration plan successfully, the resources from the failed migration are deleted automatically. ==== diff --git a/modules/migration-uninstalling-mtc-clean-up.adoc b/modules/migration-uninstalling-mtc-clean-up.adoc new file mode 100644 index 0000000000..4d321ae749 --- /dev/null +++ b/modules/migration-uninstalling-mtc-clean-up.adoc @@ -0,0 +1,95 @@ +// Module included in the following assemblies: +// +// * migrating_from_ocp_3_to_4/troubleshooting-3-4.adoc +// * migration_toolkit_for_containers/troubleshooting-mtc + +[id="migration-uninstalling-mtc-clean-up_{context}"] += Uninstalling {mtc-short} and deleting resources + +You can uninstall the {mtc-full} ({mtc-short}) and delete its resources to clean up the cluster. + +[NOTE] +==== +Deleting the `velero` CRDs removes Velero from the cluster. +==== + +.Prerequisites + +* You must be logged in as a user with `cluster-admin` privileges. + +.Procedure + +. Delete the `MigrationController` custom resource (CR) on all clusters: ++ +[source,terminal] +---- +$ oc delete migrationcontroller +---- + +. Uninstall the {mtc-short} Operator on {product-title} 4 by using the {product-title} web console. +ifdef::troubleshooting-3-4[] +. Uninstall the {mtc-short} Operator on {product-title} 3 by deleting the `operator` CR manifest: ++ +[source,terminal] +---- +$ oc delete -f operator.yml +---- +endif::[] + +. Delete cluster-scoped resources on all clusters by running the following commands: + +* `migration` custom resource definitions (CRDs): ++ +[source,terminal] +---- +$ oc delete $(oc get crds -o name | grep 'migration.openshift.io') +---- + +* `velero` CRDs: ++ +[source,terminal] +---- +$ oc delete $(oc get crds -o name | grep 'velero') +---- + +* `migration` cluster roles: ++ +[source,terminal] +---- +$ oc delete $(oc get clusterroles -o name | grep 'migration.openshift.io') +---- + +* `migration-operator` cluster role: ++ +[source,terminal] +---- +$ oc delete clusterrole migration-operator +---- + +* `velero` cluster roles: ++ +[source,terminal] +---- +$ oc delete $(oc get clusterroles -o name | grep 'velero') +---- + +* `migration` cluster role bindings: ++ +[source,terminal] +---- +$ oc delete $(oc get clusterrolebindings -o name | grep 'migration.openshift.io') +---- + +* `migration-operator` cluster role bindings: ++ +[source,terminal] +---- +$ oc delete clusterrolebindings migration-operator +---- + +* `velero` cluster role bindings: ++ +[source,terminal] +---- +$ oc delete $(oc get clusterrolebindings -o name | grep 'velero') +----