You can install the Cluster Application Migration Operator on your OpenShift Container Platform 4.5 target cluster and 4.2 source cluster. The Cluster Application Migration Operator installs the Cluster Application Migration (CAM) tool on the target cluster by default.

Optional: You can configure the Cluster Application Migration Operator to install the CAM tool on an OpenShift Container Platform 3 cluster or on a remote cluster.

In a restricted environment, you can install the Cluster Application Migration Operator from a local mirror registry.

After you have installed the Cluster Application Migration Operator on your clusters, you can launch the CAM tool.

Installing the Cluster Application Migration Operator

You can install the Cluster Application Migration Operator with the Operation Lifecycle Manager (OLM) on an OpenShift Container Platform 4.5 target cluster and on an OpenShift Container Platform 4.1 source cluster.

Installing the Cluster Application Migration Operator on an OpenShift Container Platform 4.5 target cluster

You can install the Cluster Application Migration Operator on an OpenShift Container Platform 4.5 target cluster with the Operation Lifecycle Manager (OLM).

The Cluster Application Migration Operator installs the Cluster Application Migration tool on the target cluster by default.

Procedure
  1. In the OpenShift Container Platform web console, click OperatorsOperatorHub.

  2. Use the Filter by keyword field (in this case, Migration) to find the Cluster Application Migration Operator.

  3. Select the Cluster Application Migration Operator and click Install.

  4. On the Create Operator Subscription page, click Subscribe.

    On the Installed Operators page, the Cluster Application Migration Operator appears in the openshift-migration project with the status Succeeded.

  5. Click Cluster Application Migration Operator.

  6. Under Provided APIs, locate the Migration Controller tile, and click Create Instance.

  7. Click Create.

  8. Click WorkloadsPods to verify that the Controller Manager, Migration UI, Restic, and Velero Pods are running.

Installing the Cluster Application Migration Operator on an OpenShift Container Platform 4.2 source cluster

You can install the Cluster Application Migration Operator on an OpenShift Container Platform 4 source cluster with the Operation Lifecycle Manager (OLM).

Procedure
  1. In the OpenShift Container Platform web console, click OperatorsOperatorHub.

  2. Use the Filter by keyword field (in this case, Migration) to find the Cluster Application Migration Operator.

  3. Select the Cluster Application Migration Operator and click Install.

  4. On the Create Operator Subscription page, click Subscribe.

    On the Installed Operators page, the Cluster Application Migration Operator appears in the openshift-migration project with the status Succeeded.

  5. Click Cluster Application Migration Operator.

  6. Under Provided APIs, locate the Migration Controller tile, and click Create Instance.

  7. Set the migration_controller and migration_ui parameters to false in the spec stanza:

    spec:
      ...
      migration_controller: false
      migration_ui: false
      ...
  8. Click Create.

  9. Click WorkloadsPods to verify that the Restic and Velero Pods are running.

Installing the Cluster Application Migration Operator in a restricted environment

You can build a custom Operator catalog image for OpenShift Container Platform 4, push it to a local mirror image registry, and configure OLM to install the Operator from the local registry.

Building an Operator catalog image

Cluster administrators can build a custom Operator catalog image to be used by Operator Lifecycle Manager (OLM) and push the image to a container image registry that supports Docker v2-2. For a cluster on a restricted network, this registry can be a registry that the cluster has network access to, such as a mirror registry created during a restricted network cluster installation.

The OpenShift Container Platform cluster’s internal registry cannot be used as the target registry because it does not support pushing without a tag, which is required during the mirroring process.

For this example, the procedure assumes use of a mirror registry that has access to both your network and the internet.

Prerequisites
  • Workstation with unrestricted network access

  • oc version 4.3.5+

  • podman version 1.4.4+

  • Access to mirror registry that supports Docker v2-2

  • If you are working with private registries, set the REG_CREDS environment variable to the file path of your registry credentials for use in later steps. For example, for the podman CLI:

    $ REG_CREDS=${XDG_RUNTIME_DIR}/containers/auth.json
Procedure
  1. On the workstation with unrestricted network access, authenticate with the target mirror registry:

    $ podman login <registry_host_name>

    Also authenticate with registry.redhat.io so that the base image can be pulled during the build:

    $ podman login registry.redhat.io
  2. Build a catalog image based on the redhat-operators catalog from quay.io, tagging and pushing it to your mirror registry:

    $ oc adm catalog build \
        --appregistry-org redhat-operators \(1)
        --from=registry.redhat.io/openshift4/ose-operator-registry:v4.5 \(2)
        --filter-by-os="linux/amd64" \(3)
        --to=<registry_host_name>:<port>/olm/redhat-operators:v1 \(4)
        [-a ${REG_CREDS}] \(5)
        [--insecure] (6)
    1 Organization (namespace) to pull from an App Registry instance.
    2 Set --from to the ose-operator-registry base image using the tag that matches the target OpenShift Container Platform cluster major and minor version.
    3 Set --filter-by-os to the operating system and architecture to use for the base image, which must match the target OpenShift Container Platform cluster. Valid values are linux/amd64, linux/ppc64le, and linux/s390x.
    4 Name your catalog image and include a tag, for example, v1.
    5 Optional: If required, specify the location of your registry credentials file.
    6 Optional: If you do not want to configure trust for the target registry, add the --insecure flag.
    Example output
    INFO[0013] loading Bundles                               dir=/var/folders/st/9cskxqs53ll3wdn434vw4cd80000gn/T/300666084/manifests-829192605
    ...
    Pushed sha256:f73d42950021f9240389f99ddc5b0c7f1b533c054ba344654ff1edaf6bf827e3 to example_registry:5000/olm/redhat-operators:v1

    Sometimes invalid manifests are accidentally introduced into Red Hat’s catalogs; when this happens, you might see some errors:

    Example output with errors
    ...
    INFO[0014] directory                                     dir=/var/folders/st/9cskxqs53ll3wdn434vw4cd80000gn/T/300666084/manifests-829192605 file=4.2 load=package
    W1114 19:42:37.876180   34665 builder.go:141] error building database: error loading package into db: fuse-camel-k-operator.v7.5.0 specifies replacement that couldn't be found
    Uploading ... 244.9kB/s

    These errors are usually non-fatal, and if the Operator package mentioned does not contain an Operator you plan to install or a dependency of one, then they can be ignored.

Configuring OperatorHub for restricted networks

Cluster administrators can configure OLM and OperatorHub to use local content in a restricted network environment using a custom Operator catalog image. For this example, the procedure uses a custom redhat-operators catalog image previously built and pushed to a supported registry.

Prerequisites
  • Workstation with unrestricted network access

  • A custom Operator catalog image pushed to a supported registry

  • oc version 4.3.5+

  • podman version 1.4.4+

  • Access to mirror registry that supports Docker v2-2

  • If you are working with private registries, set the REG_CREDS environment variable to the file path of your registry credentials for use in later steps. For example, for the podman CLI:

    $ REG_CREDS=${XDG_RUNTIME_DIR}/containers/auth.json
Procedure
  1. The oc adm catalog mirror command extracts the contents of your custom Operator catalog image to generate the manifests required for mirroring. You can choose to either:

    • Allow the default behavior of the command to automatically mirror all of the image content to your mirror registry after generating manifests, or

    • Add the --manifests-only flag to only generate the manifests required for mirroring, but do not actually mirror the image content to a registry yet. This can be useful for reviewing what will be mirrored, and it allows you to make any changes to the mapping list if you only require a subset of the content. You can then use that file with the oc image mirror command to mirror the modified list of images in a later step.

    On your workstation with unrestricted network access, run the following command:

    $ oc adm catalog mirror \
        <registry_host_name>:<port>/olm/redhat-operators:v1 \(1)
        <registry_host_name>:<port> \
        [-a ${REG_CREDS}] \(2)
        [--insecure] \(3)
        [--filter-by-os="<os>/<arch>"] \(4)
        [--manifests-only] (5)
    1 Specify your Operator catalog image.
    2 Optional: If required, specify the location of your registry credentials file.
    3 Optional: If you do not want to configure trust for the target registry, add the --insecure flag.
    4 Optional: Because the catalog might reference images that support multiple architectures and operating systems, you can filter by architecture and operating system to mirror only the images that match. Valid values are linux/amd64, linux/ppc64le, and linux/s390x.
    5 Optional: Only generate the manifests required for mirroring and do not actually mirror the image content to a registry.

    After running the command, a <image_name>-manifests/ directory is created in the current directory and generates the following files:

    • The imageContentSourcePolicy.yaml file defines an ImageContentSourcePolicy object that can configure nodes to translate between the image references stored in Operator manifests and the mirrored registry.

    • The mapping.txt file contains all of the source images and where to map them in the target registry. This file is compatible with the oc image mirror command and can be used to further customize the mirroring configuration.

  2. If you used the --manifests-only flag in the previous step and want to mirror only a subset of the content:

    1. Modify the list of images in your mapping.txt file to your specifications.

    2. Still on your workstation with unrestricted network access, use your modified mapping.txt file to mirror the images to your registry using the oc image mirror command:

      $ oc image mirror \
          [-a ${REG_CREDS}] \
          -f ./redhat-operators-manifests/mapping.txt
  3. Apply the ImageContentSourcePolicy:

    $ oc apply -f ./redhat-operators-manifests/imageContentSourcePolicy.yaml
  4. Create a CatalogSource object that references your catalog image.

    1. Modify the following to your specifications and save it as a catalogsource.yaml file:

      apiVersion: operators.coreos.com/v1alpha1
      kind: CatalogSource
      metadata:
        name: my-operator-catalog
        namespace: openshift-marketplace
      spec:
        sourceType: grpc
        image: <registry_host_name>:<port>/olm/redhat-operators:v1 (1)
        displayName: My Operator Catalog
        publisher: grpc
      1 Specify your custom Operator catalog image.
    2. Use the file to create the CatalogSource object:

      $ oc create -f catalogsource.yaml
  5. Verify the following resources are created successfully.

    1. Check the Pods:

      $ oc get pods -n openshift-marketplace
      Example output
      NAME                                    READY   STATUS    RESTARTS  AGE
      my-operator-catalog-6njx6               1/1     Running   0         28s
      marketplace-operator-d9f549946-96sgr    1/1     Running   0         26h
    2. Check the CatalogSource:

      $ oc get catalogsource -n openshift-marketplace
      Example output
      NAME                  DISPLAY               TYPE PUBLISHER  AGE
      my-operator-catalog   My Operator Catalog   grpc            5s
    3. Check the PackageManifest:

      $ oc get packagemanifest -n openshift-marketplace
      Example output
      NAME    CATALOG              AGE
      etcd    My Operator Catalog  34s

You can now install the Operators from the OperatorHub page on your restricted network OpenShift Container Platform cluster web console.

Installing the Cluster Application Migration Operator on an OpenShift Container Platform 4.5 target cluster in a restricted environment

You can install the Cluster Application Migration Operator on an OpenShift Container Platform 4.5 target cluster with the Operation Lifecycle Manager (OLM).

The Cluster Application Migration Operator installs the Cluster Application Migration tool on the target cluster by default.

Prerequisites
  • You created a custom Operator catalog and pushed it to a mirror registry.

  • You configured OLM to install the Cluster Application Migration Operator from the mirror registry.

Procedure
  1. In the OpenShift Container Platform web console, click OperatorsOperatorHub.

  2. Use the Filter by keyword field (in this case, Migration) to find the Cluster Application Migration Operator.

  3. Select the Cluster Application Migration Operator and click Install.

  4. On the Create Operator Subscription page, click Subscribe.

    On the Installed Operators page, the Cluster Application Migration Operator appears in the openshift-migration project with the status Succeeded.

  5. Click Cluster Application Migration Operator.

  6. Under Provided APIs, locate the Migration Controller tile, and click Create Instance.

  7. Click Create.

  8. Click WorkloadsPods to verify that the Controller Manager, Migration UI, Restic, and Velero Pods are running.

Installing the Cluster Application Migration Operator on an OpenShift Container Platform 4.2 source cluster in a restricted environment

You can install the Cluster Application Migration Operator on an OpenShift Container Platform 4 source cluster with the Operation Lifecycle Manager (OLM).

Prerequisites
  • You created a custom Operator catalog and pushed it to a mirror registry.

  • You configured OLM to install the Cluster Application Migration Operator from the mirror registry.

Procedure
  1. In the OpenShift Container Platform web console, click OperatorsOperatorHub.

  2. Use the Filter by keyword field (in this case, Migration) to find the Cluster Application Migration Operator.

  3. Select the Cluster Application Migration Operator and click Install.

  4. On the Create Operator Subscription page, click Subscribe.

    On the Installed Operators page, the Cluster Application Migration Operator appears in the openshift-migration project with the status Succeeded.

  5. Click Cluster Application Migration Operator.

  6. Under Provided APIs, locate the Migration Controller tile, and click Create Instance.

  7. Click Create.

Launching the CAM web console

You can launch the CAM web console in a browser.

Procedure
  1. Log in to the OpenShift Container Platform cluster on which you have installed the CAM tool.

  2. Obtain the CAM web console URL by entering the following command:

    $ oc get -n openshift-migration route/migration -o go-template='https://{{ .spec.host }}'

    The output resembles the following: https://migration-openshift-migration.apps.cluster.openshift.com.

  3. Launch a browser and navigate to the CAM web console.

    If you try to access the CAM web console immediately after installing the Cluster Application Migration Operator, the console may not load because the Operator is still configuring the cluster. Wait a few minutes and retry.

  4. If you are using self-signed CA certificates, you will be prompted to accept the CA certificate of the source cluster’s API server. The web page guides you through the process of accepting the remaining certificates.

  5. Log in with your OpenShift Container Platform username and password.

Upgrading the Cluster Application Migration Tool

You can upgrade your Cluster Application Migration (CAM) tool on your source and target clusters.

If you are upgrading from CAM 1.1 to 1.2, you must update the service account token in the CAM web console.

Upgrading the CAM tool on an OpenShift Container Platform 4 cluster

You can upgrade the CAM tool on an OpenShift Container Platform 4 cluster with the Operator Lifecycle Manager.

If you selected the Automatic approval option when you subscribed to the Cluster Application Migration Operator, the CAM tool is updated automatically.

The following procedure enables you to change the Manual approval option to Automatic or to change the release channel.

Procedure
  1. In the OpenShift Container Platform console, navigate to Operators > Installed Operators.

  2. Click Cluster Application Migration Operator.

  3. In the Subscription tab, change the Approval option to Automatic.

  4. Optional: Edit the Channel.

    Updating the subscription deploys the updated Cluster Application Migration Operator and updates the CAM tool components.

Updating the service account token

If you are upgrading from CAM 1.1 to 1.2, you must update the service account token in the CAM web console.

CAM 1.1 uses the mig service account, while CAM 1.2 uses the migration-controller service account.

Procedure
  1. Log in to a cluster and obtain the migration-controller service account token:

    $ oc sa get-token -n openshift-migration migration-controller
  2. Log in to the CAM web console and click Clusters.

  3. Click the Options menu kebab of the cluster and select Edit.

  4. Copy the new token to the Service account token field.

  5. Click Update cluster and then click Close.

    The service account token is updated for the cluster.