mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
90 lines
4.3 KiB
Plaintext
90 lines
4.3 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * installing/disconnected_install/installing-mirroring-disconnected-v2.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="oc-mirror-procedure-delete-v2_{context}"]
|
|
= Deleting images from a disconnected environment
|
|
|
|
To delete images from a disconnected environment using the oc-mirror plugin v2, follow the procedure.
|
|
|
|
// Could someone elaborate what the overall workflow for this process is? Does running that first step create a DeleteImageSetConfig template file with entries based on the contents of the `--workspace` directory, and then users pick and choose which images to keep in the template before running the final command to delete the manifests?
|
|
|
|
//Additionally, would it be more accurate to either rename this section to "deleting image manifests from..", or make a prereq about enabling a garbage collector in your registry?
|
|
|
|
.Prerequisites
|
|
|
|
* You have enabled garbage collection in your environment to delete images that no longer reference manifests.
|
|
|
|
.Procedure
|
|
|
|
. Create a `delete-image-set-config.yaml` file and include the following content:
|
|
+
|
|
.`DeleteImageSetConfiguration` file
|
|
[source,yaml]
|
|
----
|
|
apiVersion: mirror.openshift.io/v2alpha1
|
|
kind: DeleteImageSetConfiguration
|
|
delete:
|
|
platform:
|
|
channels:
|
|
- name: <channel_name> <1>
|
|
minVersion: <channel_min_version> <2>
|
|
maxVersion: <channel_max_version> <2>
|
|
operators:
|
|
- catalog: <operator_catalog_name> <3>
|
|
packages:
|
|
- name: <operator_name> <4>
|
|
minVersion: <operator_max_version> <5>
|
|
maxVersion: <operator_min_version> <5>
|
|
additionalImages:
|
|
- name: <additional_images>
|
|
----
|
|
<1> Specify the name of the {product-title} channel to delete, for example `stable-4.15`.
|
|
<2> Specify a version range of the images to delete within the channel, for example `4.15.0` for the minimum version and `4.15.1` for the maximum version.
|
|
To delete only one version's images, use that version number for both the `minVersion` and `maxVersion` fields.
|
|
<3> Specify an Operator catalog image containing the Operators to delete, for example `registry.redhat.io/redhat/redhat-operator-index:v4.14`.
|
|
The Operator catalog image will not get deleted. Its presence in the registry might be necessary for other Operators still remaining on the cluster.
|
|
<4> Specify a specific Operator to delete, for example `aws-load-balancer-operator`.
|
|
<5> Specify a version range of the images to delete for the Operator, for example `0.0.1` for the minimum version and `0.0.2` for the maximum version.
|
|
|
|
. Create a `delete-images.yaml` file by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc-mirror delete --config delete-image-set-config.yaml --workspace file://<previously_mirrored_work_folder> --v2 --generate docker://<remote_registry>
|
|
----
|
|
+
|
|
where:
|
|
|
|
<previously_mirrored_work_folder>:: Specifies the directory where images were previously mirrored to or stored during the mirroring process.
|
|
<remote_registry>:: Specifies the URL or address of the remote container registry from which images will be deleted.
|
|
+
|
|
[IMPORTANT]
|
|
====
|
|
When deleting images, specify the correct workspace directory. Modify or delete the cache directory only when starting mirroring from scratch, such as setting up a new cluster. Incorrect changes to the cache directory might disrupt further mirroring operations.
|
|
====
|
|
|
|
. Go to the `<previously_mirrored_work_folder>/delete` directory that was created.
|
|
|
|
. Verify that the `delete-images.yaml` file has been generated.
|
|
|
|
. Manually ensure that each image listed in the file is no longer needed by the cluster and can be safely removed from the registry.
|
|
|
|
. After you generate the `delete-images` YAML file, delete the images from the remote registry by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc-mirror delete --v2 --delete-yaml-file <previously_mirrored_work_folder>/working-dir/delete/delete-images.yaml docker://<remote_registry>
|
|
----
|
|
+
|
|
where:
|
|
|
|
<previously_mirrored_work_folder>:: Specifies the directory where images were previously mirrored or stored during the mirroring process.
|
|
<remote_registry>:: Specifies the URL or address of the remote container registry from which images will be deleted.
|
|
+
|
|
[IMPORTANT]
|
|
====
|
|
When using the mirror-to-mirror method to mirror images, images are not cached locally, so you cannot delete images from a local cache.
|
|
====
|