Converting ImageContentSourcePolicy (ICSP) files for image registry repository mirroring

You can convert existing ImageContentSourcePolicy (ICSP) files to ImageDigestMirrorSet files to configure image registry repository mirroring.

Using an ImageContentSourcePolicy (ICSP) object to configure repository mirroring is a deprecated feature.

This functionality is still included in Red Hat OpenShift Container Platform and continues to be supported; however, it will be removed in a future release of this product and is not recommended for new deployments.

ICSP objects are being replaced by ImageDigestMirrorSet and ImageTagMirrorSet objects to configure repository mirroring. If you have existing YAML files that you used to create ImageContentSourcePolicy objects, you can use the oc adm migrate icsp command to convert those files to an ImageDigestMirrorSet YAML file. The command updates the API to the current version, changes the kind value to ImageDigestMirrorSet, and changes spec.repositoryDigestMirrors to spec.imageDigestMirrors. The rest of the file is not changed.

Because the migration does not change the registries.conf file, the cluster does not need to reboot.

For more information about ImageDigestMirrorSet or ImageTagMirrorSet objects, see "Configuring image registry repository mirroring" in the previous section.

Prerequisites
  • Access to the cluster as a user with the cluster-admin role.

  • Ensure that you have ImageContentSourcePolicy objects on your cluster.

Procedure
  1. Use the following command to convert one or more ImageContentSourcePolicy YAML files to an ImageDigestMirrorSet YAML file:

    $ oc adm migrate icsp <file_name>.yaml <file_name>.yaml <file_name>.yaml --dest-dir <path_to_the_directory>

    where:

    <file_name>

    Specifies the name of the source ImageContentSourcePolicy YAML. You can list multiple file names.

    --dest-dir

    Optional: Specifies a directory for the output ImageDigestMirrorSet YAML. If unset, the file is written to the current directory.

    For example, the following command converts the icsp.yaml and icsp-2.yaml file and saves the new YAML files to the idms-files directory.

    $ oc adm migrate icsp icsp.yaml icsp-2.yaml --dest-dir idms-files
    Example output
    wrote ImageDigestMirrorSet to idms-files/imagedigestmirrorset_ubi8repo.5911620242173376087.yaml
    wrote ImageDigestMirrorSet to idms-files/imagedigestmirrorset_ubi9repo.6456931852378115011.yaml
  2. Create the CR object by running the following command:

    $ oc create -f <path_to_the_directory>/<file-name>.yaml

    where:

    <path_to_the_directory>

    Specifies the path to the directory, if you used the --dest-dir flag.

    <file_name>

    Specifies the name of the ImageDigestMirrorSet YAML.

  3. Remove the ICSP objects after the IDMS objects are rolled out.