|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * disconnected/mirroring/oc-mirror-migration-v1-to-v2.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="oc-mirror-migration-process_{context}"] |
| 7 | += Migrating to oc-mirror plugin v2 |
| 8 | + |
| 9 | +To migrate from oc-mirror plugin v1 to v2, you must manually update the `ImageSetConfiguration` file, modify mirroring commands, and clean up v1 artifacts. Follow these steps to complete the migration. |
| 10 | + |
| 11 | +.Procedure |
| 12 | + |
| 13 | +. Modify the API version and remove deprecated fields in your `ImageSetConfiguration`. |
| 14 | ++ |
| 15 | +.Example `ImageSetConfiguration` file with oc-mirror plugin v1 configuration |
| 16 | +[source,yaml] |
| 17 | +---- |
| 18 | +kind: ImageSetConfiguration |
| 19 | +apiVersion: mirror.openshift.io/v1alpha2 |
| 20 | +mirror: |
| 21 | + platform: |
| 22 | + channels: |
| 23 | + - name: stable-4.17 |
| 24 | + graph: true |
| 25 | + helm: |
| 26 | + repositories: |
| 27 | + - name: sbo |
| 28 | + url: https://redhat-developer.github.io/service-binding-operator-helm-chart/ |
| 29 | + additionalImages: |
| 30 | + - name: registry.redhat.io/ubi8/ubi:latest |
| 31 | + - name: quay.io/openshifttest/hello-openshift@sha256:example_hash |
| 32 | + operators: |
| 33 | + - catalog: oci:///test/redhat-operator-index |
| 34 | + packages: |
| 35 | + - name: aws-load-balancer-operator |
| 36 | +storageConfig: # REMOVE this field in v2 |
| 37 | + local: |
| 38 | + path: /var/lib/oc-mirror |
| 39 | +---- |
| 40 | ++ |
| 41 | +.Example `ImageSetConfiguration` file with oc-mirror plugin v2 configuration |
| 42 | +[source,yaml] |
| 43 | +---- |
| 44 | +kind: ImageSetConfiguration |
| 45 | +apiVersion: mirror.openshift.io/v2alpha1 |
| 46 | +mirror: |
| 47 | + platform: |
| 48 | + channels: |
| 49 | + - name: stable-4.17 |
| 50 | + graph: true |
| 51 | + helm: |
| 52 | + repositories: |
| 53 | + - name: sbo |
| 54 | + url: https://redhat-developer.github.io/service-binding-operator-helm-chart/ |
| 55 | + additionalImages: |
| 56 | + - name: registry.redhat.io/ubi8/ubi:latest |
| 57 | + - name: quay.io/openshifttest/hello-openshift@sha256:example_hash |
| 58 | + operators: |
| 59 | + - catalog: oci:///test/redhat-operator-index |
| 60 | + packages: |
| 61 | + - name: aws-load-balancer-operator |
| 62 | +---- |
| 63 | + |
| 64 | +. Check the `cluster-resources` directory inside the working directory for IDMS, ITMS, `CatalogSource`, and `ClusterCatalog` resources by running the following command: |
| 65 | ++ |
| 66 | +[source,terminal] |
| 67 | +---- |
| 68 | +$ ls <v2_workspace>/working-dir/cluster-resources/ |
| 69 | +---- |
| 70 | + |
| 71 | +. Once the migration is complete, verify that mirrored images and catalogs are available: |
| 72 | +- Ensure that no errors or warnings occurred during mirroring. |
| 73 | +- Ensure that no error file was generated (`working-dir/logs/mirroring_errors_YYYYMMdd_HHmmss.txt`). |
| 74 | + |
| 75 | +. Verify that mirrored images and catalogs are available using the following the commands: |
| 76 | ++ |
| 77 | +[source,terminal] |
| 78 | +---- |
| 79 | +$ oc get catalogsource -n openshift-marketplace |
| 80 | +---- |
| 81 | ++ |
| 82 | +[source,terminal] |
| 83 | +---- |
| 84 | +$ oc get imagedigestmirrorset,imagetagmirrorset -n openshift-config |
| 85 | +---- |
| 86 | ++ |
| 87 | +For more information, refer to "Mirroring images for a disconnected installation using oc-mirror plugin v2". |
| 88 | + |
| 89 | +. Optional: Remove images mirrored using oc-mirror plugin v1: |
| 90 | + |
| 91 | +.. Mirror the images using oc-mirror plugin v1. |
| 92 | + |
| 93 | +.. Update the API version in the `ImageSetConfiguration` file from `v1alpha2` (v1) to `v2alpha1` (v2), then run the following command: |
| 94 | ++ |
| 95 | +[source,terminal] |
| 96 | +---- |
| 97 | +$ oc-mirror -c isc.yaml file://some-dir --v2 |
| 98 | +---- |
| 99 | ++ |
| 100 | +[NOTE] |
| 101 | +==== |
| 102 | +`storageConfig` is not a valid field in the `ImageSetConfiguration` and `DeleteImageSetConfiguration` files. Remove this field when updating to oc-mirror plugin v2. |
| 103 | +==== |
| 104 | + |
| 105 | +.. Generate a delete manifest and delete v1 images by running the following command: |
| 106 | ++ |
| 107 | +[source,terminal] |
| 108 | +---- |
| 109 | +$ oc-mirror delete --config=delete-isc.yaml --generate --delete-v1-images --workspace file://some-dir docker://registry.example:5000 --v2 |
| 110 | +---- |
| 111 | ++ |
| 112 | +[IMPORTANT] |
| 113 | +==== |
| 114 | +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-images` command flag. |
| 115 | +
|
| 116 | +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`. |
| 117 | +==== |
| 118 | ++ |
| 119 | +For more information about deleting images, see "Deletion of images from your disconnected environment". |
| 120 | + |
| 121 | +.. Delete images based on the generated manifest by running the following command: |
| 122 | ++ |
| 123 | +[source,terminal] |
| 124 | +---- |
| 125 | +$ oc-mirror delete --delete-yaml-file some-dir/working-dir/delete/delete-images.yaml docker://registry.example:5000 --v2 |
| 126 | +---- |
0 commit comments