mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
365 lines
13 KiB
Plaintext
365 lines
13 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * migrating_from_ocp_3_to_4/migrating-applications-3-4.adoc
|
|
// * migration_toolkit_for_containers/migrating-applications-with-mtc
|
|
|
|
[id="migration-mtc-cr-manifests_{context}"]
|
|
= {mtc-full} custom resource manifests
|
|
|
|
{mtc-first} uses the following custom resource (CR) manifests for migrating applications.
|
|
|
|
[id="directimagemigration_{context}"]
|
|
== DirectImageMigration
|
|
|
|
The `DirectImageMigration` CR copies images directly from the source cluster to the destination cluster.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: DirectImageMigration
|
|
metadata:
|
|
labels:
|
|
controller-tools.k8s.io: "1.0"
|
|
name: <direct_image_migration>
|
|
spec:
|
|
srcMigClusterRef:
|
|
name: <source_cluster>
|
|
namespace: openshift-migration
|
|
destMigClusterRef:
|
|
name: <destination_cluster>
|
|
namespace: openshift-migration
|
|
namespaces: <1>
|
|
- <source_namespace_1>
|
|
- <source_namespace_2>:<destination_namespace_3> <2>
|
|
----
|
|
<1> One or more namespaces containing images to be migrated. By default, the destination namespace has the same name as the source namespace.
|
|
<2> Source namespace mapped to a destination namespace with a different name.
|
|
|
|
[id="directimagestreammigration_{context}"]
|
|
== DirectImageStreamMigration
|
|
|
|
The `DirectImageStreamMigration` CR copies image stream references directly from the source cluster to the destination cluster.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: DirectImageStreamMigration
|
|
metadata:
|
|
labels:
|
|
controller-tools.k8s.io: "1.0"
|
|
name: <direct_image_stream_migration>
|
|
spec:
|
|
srcMigClusterRef:
|
|
name: <source_cluster>
|
|
namespace: openshift-migration
|
|
destMigClusterRef:
|
|
name: <destination_cluster>
|
|
namespace: openshift-migration
|
|
imageStreamRef:
|
|
name: <image_stream>
|
|
namespace: <source_image_stream_namespace>
|
|
destNamespace: <destination_image_stream_namespace>
|
|
----
|
|
|
|
[id="directvolumemigration_{context}"]
|
|
== DirectVolumeMigration
|
|
|
|
The `DirectVolumeMigration` CR copies persistent volumes (PVs) directly from the source cluster to the destination cluster.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: DirectVolumeMigration
|
|
metadata:
|
|
name: <direct_volume_migration>
|
|
namespace: openshift-migration
|
|
spec:
|
|
createDestinationNamespaces: false <1>
|
|
deleteProgressReportingCRs: false <2>
|
|
destMigClusterRef:
|
|
name: <host_cluster> <3>
|
|
namespace: openshift-migration
|
|
persistentVolumeClaims:
|
|
- name: <pvc> <4>
|
|
namespace: <pvc_namespace>
|
|
srcMigClusterRef:
|
|
name: <source_cluster>
|
|
namespace: openshift-migration
|
|
----
|
|
<1> Set to `true` to create namespaces for the PVs on the destination cluster.
|
|
<2> Set to `true` to delete `DirectVolumeMigrationProgress` CRs after migration. The default is `false` so that `DirectVolumeMigrationProgress` CRs are retained for troubleshooting.
|
|
<3> Update the cluster name if the destination cluster is not the host cluster.
|
|
<4> Specify one or more PVCs to be migrated.
|
|
|
|
[id="directvolumemigrationprogress_{context}"]
|
|
== DirectVolumeMigrationProgress
|
|
|
|
The `DirectVolumeMigrationProgress` CR shows the progress of the `DirectVolumeMigration` CR.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: DirectVolumeMigrationProgress
|
|
metadata:
|
|
labels:
|
|
controller-tools.k8s.io: "1.0"
|
|
name: <direct_volume_migration_progress>
|
|
spec:
|
|
clusterRef:
|
|
name: <source_cluster>
|
|
namespace: openshift-migration
|
|
podRef:
|
|
name: <rsync_pod>
|
|
namespace: openshift-migration
|
|
----
|
|
|
|
[id="miganalytic_{context}"]
|
|
== MigAnalytic
|
|
|
|
The `MigAnalytic` CR collects the number of images, Kubernetes resources, and the persistent volume (PV) capacity from an associated `MigPlan` CR.
|
|
|
|
You can configure the data that it collects.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: MigAnalytic
|
|
metadata:
|
|
annotations:
|
|
migplan: <migplan>
|
|
name: <miganalytic>
|
|
namespace: openshift-migration
|
|
labels:
|
|
migplan: <migplan>
|
|
spec:
|
|
analyzeImageCount: true <1>
|
|
analyzeK8SResources: true <2>
|
|
analyzePVCapacity: true <3>
|
|
listImages: false <4>
|
|
listImagesLimit: 50 <5>
|
|
migPlanRef:
|
|
name: <migplan>
|
|
namespace: openshift-migration
|
|
----
|
|
<1> Optional: Returns the number of images.
|
|
<2> Optional: Returns the number, kind, and API version of the Kubernetes resources.
|
|
<3> Optional: Returns the PV capacity.
|
|
<4> Returns a list of image names. The default is `false` so that the output is not excessively long.
|
|
<5> Optional: Specify the maximum number of image names to return if `listImages` is `true`.
|
|
|
|
[id="migcluster_{context}"]
|
|
== MigCluster
|
|
|
|
The `MigCluster` CR defines a host, local, or remote cluster.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: MigCluster
|
|
metadata:
|
|
labels:
|
|
controller-tools.k8s.io: "1.0"
|
|
name: <host_cluster> <1>
|
|
namespace: openshift-migration
|
|
spec:
|
|
isHostCluster: true <2>
|
|
# The 'azureResourceGroup' parameter is relevant only for Microsoft Azure.
|
|
azureResourceGroup: <azure_resource_group> <3>
|
|
caBundle: <ca_bundle_base64> <4>
|
|
insecure: false <5>
|
|
refresh: false <6>
|
|
# The 'restartRestic' parameter is relevant for a source cluster.
|
|
restartRestic: true <7>
|
|
# The following parameters are relevant for a remote cluster.
|
|
exposedRegistryPath: <registry_route> <8>
|
|
url: <destination_cluster_url> <9>
|
|
serviceAccountSecretRef:
|
|
name: <source_secret> <10>
|
|
namespace: openshift-config
|
|
----
|
|
<1> Update the cluster name if the `migration-controller` pod is not running on this cluster.
|
|
<2> The `migration-controller` pod runs on this cluster if `true`.
|
|
<3> Microsoft Azure only: Specify the resource group.
|
|
<4> Optional: If you created a certificate bundle for self-signed CA certificates and if the `insecure` parameter value is `false`, specify the base64-encoded certificate bundle.
|
|
<5> Set to `true` to disable SSL verification.
|
|
<6> Set to `true` to validate the cluster.
|
|
<7> Set to `true` to restart the `Restic` pods on the source cluster after the `Stage` pods are created.
|
|
<8> Remote cluster and direct image migration only: Specify the exposed secure registry path.
|
|
<9> Remote cluster only: Specify the URL.
|
|
<10> Remote cluster only: Specify the name of the `Secret` object.
|
|
|
|
[id="mighook_{context}"]
|
|
== MigHook
|
|
|
|
The `MigHook` CR defines a migration hook that runs custom code at a specified stage of the migration. You can create up to four migration hooks. Each hook runs during a different phase of the migration.
|
|
|
|
You can configure the hook name, runtime duration, a custom image, and the cluster where the hook will run.
|
|
|
|
The migration phases and namespaces of the hooks are configured in the `MigPlan` CR.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: MigHook
|
|
metadata:
|
|
generateName: <hook_name_prefix> <1>
|
|
name: <mighook> <2>
|
|
namespace: openshift-migration
|
|
spec:
|
|
activeDeadlineSeconds: 1800 <3>
|
|
custom: false <4>
|
|
image: <hook_image> <5>
|
|
playbook: <ansible_playbook_base64> <6>
|
|
targetCluster: source <7>
|
|
----
|
|
<1> Optional: A unique hash is appended to the value for this parameter so that each migration hook has a unique name. You do not need to specify the value of the `name` parameter.
|
|
<2> Specify the migration hook name, unless you specify the value of the `generateName` parameter.
|
|
<3> Optional: Specify the maximum number of seconds that a hook can run. The default is `1800`.
|
|
<4> The hook is a custom image if `true`. The custom image can include Ansible or it can be written in a different programming language.
|
|
<5> Specify the custom image, for example, `quay.io/konveyor/hook-runner:latest`. Required if `custom` is `true`.
|
|
<6> Base64-encoded Ansible playbook. Required if `custom` is `false`.
|
|
<7> Specify the cluster on which the hook will run. Valid values are `source` or `destination`.
|
|
|
|
[id="migmigration_{context}"]
|
|
== MigMigration
|
|
|
|
The `MigMigration` CR runs a `MigPlan` CR.
|
|
|
|
You can configure a `Migmigration` CR to run a stage or incremental migration, to cancel a migration in progress, or to roll back a completed migration.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: MigMigration
|
|
metadata:
|
|
labels:
|
|
controller-tools.k8s.io: "1.0"
|
|
name: <migmigration>
|
|
namespace: openshift-migration
|
|
spec:
|
|
canceled: false <1>
|
|
rollback: false <2>
|
|
stage: false <3>
|
|
quiescePods: true <4>
|
|
keepAnnotations: true <5>
|
|
verify: false <6>
|
|
migPlanRef:
|
|
name: <migplan>
|
|
namespace: openshift-migration
|
|
----
|
|
<1> Set to `true` to cancel a migration in progress.
|
|
<2> Set to `true` to roll back a completed migration.
|
|
<3> Set to `true` to run a stage migration. Data is copied incrementally and the pods on the source cluster are not stopped.
|
|
<4> Set to `true` to stop the application during migration. The pods on the source cluster are scaled to `0` after the `Backup` stage.
|
|
<5> Set to `true` to retain the labels and annotations applied during the migration.
|
|
<6> Set to `true` to check the status of the migrated pods on the destination cluster are checked and to return the names of pods that are not in a `Running` state.
|
|
|
|
[id="migplan_{context}"]
|
|
== MigPlan
|
|
|
|
The `MigPlan` CR defines the parameters of a migration plan.
|
|
|
|
You can configure destination namespaces, hook phases, and direct or indirect migration.
|
|
|
|
[NOTE]
|
|
====
|
|
By default, a destination namespace has the same name as the source namespace. If you configure a different destination namespace, you must ensure that the namespaces are not duplicated on the source or the destination clusters because the UID and GID ranges are copied during migration.
|
|
====
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: MigPlan
|
|
metadata:
|
|
labels:
|
|
controller-tools.k8s.io: "1.0"
|
|
name: <migplan>
|
|
namespace: openshift-migration
|
|
spec:
|
|
closed: false <1>
|
|
srcMigClusterRef:
|
|
name: <source_cluster>
|
|
namespace: openshift-migration
|
|
destMigClusterRef:
|
|
name: <destination_cluster>
|
|
namespace: openshift-migration
|
|
hooks: <2>
|
|
- executionNamespace: <namespace> <3>
|
|
phase: <migration_phase> <4>
|
|
reference:
|
|
name: <hook> <5>
|
|
namespace: <hook_namespace> <6>
|
|
serviceAccount: <service_account> <7>
|
|
indirectImageMigration: true <8>
|
|
indirectVolumeMigration: false <9>
|
|
migStorageRef:
|
|
name: <migstorage>
|
|
namespace: openshift-migration
|
|
namespaces:
|
|
- <source_namespace_1> <10>
|
|
- <source_namespace_2>
|
|
- <source_namespace_3>:<destination_namespace_4> <11>
|
|
refresh: false <12>
|
|
----
|
|
<1> The migration has completed if `true`. You cannot create another `MigMigration` CR for this `MigPlan` CR.
|
|
<2> Optional: You can specify up to four migration hooks. Each hook must run during a different migration phase.
|
|
<3> Optional: Specify the namespace in which the hook will run.
|
|
<4> Optional: Specify the migration phase during which a hook runs. One hook can be assigned to one phase. Valid values are `PreBackup`, `PostBackup`, `PreRestore`, and `PostRestore`.
|
|
<5> Optional: Specify the name of the `MigHook` CR.
|
|
<6> Optional: Specify the namespace of `MigHook` CR.
|
|
<7> Optional: Specify a service account with `cluster-admin` privileges.
|
|
<8> Direct image migration is disabled if `true`. Images are copied from the source cluster to the replication repository and from the replication repository to the destination cluster.
|
|
<9> Direct volume migration is disabled if `true`. PVs are copied from the source cluster to the replication repository and from the replication repository to the destination cluster.
|
|
<10> Specify one or more source namespaces. If you specify only the source namespace, the destination namespace is the same.
|
|
<11> Specify the destination namespace if it is different from the source namespace.
|
|
<12> The `MigPlan` CR is validated if `true`.
|
|
|
|
[id="migstorage_{context}"]
|
|
== MigStorage
|
|
|
|
The `MigStorage` CR describes the object storage for the replication repository.
|
|
|
|
Amazon Web Services (AWS), Microsoft Azure, Google Cloud Storage, Multi-Cloud Object Gateway, and generic S3-compatible cloud storage are supported.
|
|
|
|
AWS and the snapshot copy method have additional parameters.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: migration.openshift.io/v1alpha1
|
|
kind: MigStorage
|
|
metadata:
|
|
labels:
|
|
controller-tools.k8s.io: "1.0"
|
|
name: <migstorage>
|
|
namespace: openshift-migration
|
|
spec:
|
|
backupStorageProvider: <backup_storage_provider> <1>
|
|
volumeSnapshotProvider: <snapshot_storage_provider> <2>
|
|
backupStorageConfig:
|
|
awsBucketName: <bucket> <3>
|
|
awsRegion: <region> <4>
|
|
credsSecretRef:
|
|
namespace: openshift-config
|
|
name: <storage_secret> <5>
|
|
awsKmsKeyId: <key_id> <6>
|
|
awsPublicUrl: <public_url> <7>
|
|
awsSignatureVersion: <signature_version> <8>
|
|
volumeSnapshotConfig:
|
|
awsRegion: <region> <9>
|
|
credsSecretRef:
|
|
namespace: openshift-config
|
|
name: <storage_secret> <10>
|
|
refresh: false <11>
|
|
----
|
|
<1> Specify the storage provider.
|
|
<2> Snapshot copy method only: Specify the storage provider.
|
|
<3> AWS only: Specify the bucket name.
|
|
<4> AWS only: Specify the bucket region, for example, `us-east-1`.
|
|
<5> Specify the name of the `Secret` object that you created for the storage.
|
|
<6> AWS only: If you are using the AWS Key Management Service, specify the unique identifier of the key.
|
|
<7> AWS only: If you granted public access to the AWS bucket, specify the bucket URL.
|
|
<8> AWS only: Specify the AWS signature version for authenticating requests to the bucket, for example, `4`.
|
|
<9> Snapshot copy method only: Specify the geographical region of the clusters.
|
|
<10> Snapshot copy method only: Specify the name of the `Secret` object that you created for the storage.
|
|
<11> Set to `true` to validate the cluster.
|