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.
-
Modify the API version and remove deprecated fields in your
ImageSetConfiguration.ExampleImageSetConfigurationfile 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-mirrorExampleImageSetConfigurationfile 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-operatorWhen 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:$ ls <v2_workspace>/working-dir/cluster-resources/ -
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:
$ oc get catalogsource -n openshift-marketplace$ oc get imagedigestmirrorset,imagetagmirrorsetFor 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:$ oc-mirror -c isc.yaml file://some-dir --v2storageConfigis 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 --v2oc-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:
$ oc-mirror delete --delete-yaml-file some-dir/working-dir/delete/delete-images.yaml docker://registry.example:5000 --v2
-