Migrating from oc-mirror plugin v1 to v2¶
The oc-mirror v2 plugin introduces major changes to image mirroring workflows. Understand the migration process and check for compatibility with oc-mirror plugin v2 to ensure a successful migration.
Warning
You must manually update the configurations by modifying the API version and removing deprecated fields. For more information, see "Changes from oc-mirror plugin v1 to v2".
Changes from oc-mirror plugin v1 to v2¶
Before migrating from oc-mirror plugin v1 to v2, you must review the updated mirroring workflow commands, which have changed to align with the new v2 workflow.
-
For mirror-to-disk, run the following command:
-
For disk-to-mirror, run the following command:
-
For mirror-to-mirror, run the following command:
Note
--workspaceis now required for mirror-to-mirror operation.-
API version update: The
ImageSetConfigurationAPI version changes fromv1alpha2(v1) tov2alpha1(v2). You must manually update the configuration files before migration. -
Configuration changes:
storageConfigmust be removed in oc-mirror plugin v2.- Incremental mirroring is now handled automatically through the working directory or local cache.
-
Changes in results directory: All custom resources to be applied to the disconnected cluster are generated in the
<workspace_path>/working-dir/cluster-resourcesdirectory after the migration.- Outputs in oc-mirror plugin v2 are not stored in the same location as oc-mirror plugin v1.
- You must check the
cluster-resourcesfolder under the working directory for the following resources:
-
-
ImageDigestMirrorSet(IDMS) -
ImageTagMirrorSet(ITMS) -
CatalogSource -
ClusterCatalog -
UpdateService-
Workspace and directory naming: Follow the new oc-mirror v2 convention to prevent any potential data inconsistencies when transitioning between versions.
- The oc-mirror plugin v1
oc-mirror-workspacedirectory is no longer needed. - Use a new directory for oc-mirror plugin v2 to avoid conflicts.
- The oc-mirror plugin v1
-
Replacing
ImageContentSourcePolicy(ICSP) resources with IDMS/ITMS:Warning
Deleting all
ImageContentSourcePolicy(ICSP) resources might remove configurations unrelated to oc-mirror.To avoid unintended deletions, identify ICSP resources generated by oc-mirror before removing them. If you are unsure, check with your cluster administrator. For more information, see "Mirroring images for a disconnected installation by using the oc-mirror plugin v2".
- In oc-mirror plugin v2, the ICSP resource is replaced by
ImageDigestMirrorSet(IDMS) andImageTagMirrorSet(ITMS) resources.
- In oc-mirror plugin v2, the ICSP resource is replaced by
-
Migrating to oc-mirror plugin v2¶
To migrate from oc-mirror plugin v1 to v2, you must manually update the ImageSetConfiguration file, modify mirroring commands, and clean up v1 artifacts.
Procedure
-
Modify the API version and remove deprecated fields in your
ImageSetConfiguration.Example ImageSetConfiguration file with oc-mirror plugin v1 configurationkind: ImageSetConfiguration apiVersion: mirror.openshift.io/v1alpha2 mirror: platform: channels: - name: stable-4.17 graph: true helm: repositories: - name: sbo url: https://redhat-developer.github.io/service-binding-operator-helm-chart/ additionalImages: - name: registry.redhat.io/ubi8/ubi:latest - name: quay.io/openshifttest/hello-openshift@sha256:example_hash operators: - catalog: oci:///test/redhat-operator-index packages: - name: aws-load-balancer-operator storageConfig: # REMOVE this field in v2 local: path: /var/lib/oc-mirrorExample ImageSetConfiguration file with oc-mirror plugin v2 configurationkind: ImageSetConfiguration apiVersion: mirror.openshift.io/v2alpha1 mirror: platform: channels: - name: stable-4.17 graph: true helm: repositories: - name: sbo url: https://redhat-developer.github.io/service-binding-operator-helm-chart/ additionalImages: - name: registry.redhat.io/ubi8/ubi:latest - name: quay.io/openshifttest/hello-openshift@sha256:example_hash operators: - catalog: oci:///test/redhat-operator-index packages: - name: aws-load-balancer-operatorNote
When migrating from oc-mirror plugin v1 to v2, you must use explicit registry hostnames for all images listed under
additionalImages. Otherwise, images are mirrored to incorrect target paths. -
Check the
cluster-resourcesdirectory inside the working directory for IDMS, ITMS,CatalogSource, andClusterCatalogresources by running the following command: -
Once the migration is complete, verify that mirrored images and catalogs are available:
- Ensure that no errors or warnings occurred during mirroring.
- Ensure that no error file was generated (
working-dir/logs/mirroring_errors_YYYYMMdd_HHmmss.txt).
-
Verify that mirrored images and catalogs are available using the following the commands:
For more information, refer to "Mirroring images for a disconnected installation using oc-mirror plugin v2".
-
Optional: Remove images mirrored using oc-mirror plugin v1:
-
Mirror the images using oc-mirror plugin v1.
-
Update the API version in the
ImageSetConfigurationfile fromv1alpha2(v1) tov2alpha1(v2), then run the following command:Note
storageConfigis not a valid field in theImageSetConfigurationandDeleteImageSetConfigurationfiles. Remove this field when updating to oc-mirror plugin v2. -
Generate a delete manifest and delete v1 images by running the following command:
$ oc-mirror delete --config=delete-isc.yaml --generate --delete-v1-images --workspace file://some-dir docker://registry.example:5000 --v2Warning
oc-mirror plugin v2 does not automatically prune the destination registry, unlike oc-mirror plugin v1. To clean up images that are no longer needed, use the delete functionality in v2 with the
--delete-v1-imagescommand flag.Once all images mirrored with oc-mirror plugin v1 are removed, you no longer need to use this flag. If you need to delete images mirrored with oc-mirror plugin v2, do not set
--delete-v1-images.For more information about deleting images, see "Deletion of images from your disconnected environment".
-
Delete images based on the generated manifest by running the following command:
-
Additional resources