Skip to content

Commit 649c738

Browse files
authored
Merge pull request #97093 from sr1kar99/13788-dir
OSDOCS#13788: Added info for cache and workspace directories in oc-mirror doc
2 parents 2300f58 + 2e79615 commit 649c738

File tree

4 files changed

+73
-4
lines changed

4 files changed

+73
-4
lines changed

disconnected/mirroring/about-installing-oc-mirror-v2.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ include::modules/oc-mirror-imageset-config-parameters-v2.adoc[leveloffset=+1]
136136
// Command reference for oc-mirror v2
137137
include::modules/oc-mirror-command-reference-v2.adoc[leveloffset=+1]
138138
include::modules/oc-mirror-command-reference-v2-delete.adoc[leveloffset=+2]
139+
include::modules/oc-mirror-about-cache-and-workspace-dirs.adoc[leveloffset=+2]
139140

140141
[role="_additional-resources"]
141142
.Additional resources
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * installing/disconnected_install/installing-mirroring-disconnected-v2.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="oc-mirror-about-cache-and-workspace-dirs_{context}"]
7+
= About the --cache-dir and --workspace flags
8+
9+
You can use the `--cache-dir` flag to specify a directory where the oc-mirror plugin stores a persistent cache of image blobs and manifests for use during mirroring operations.
10+
11+
The oc-mirror plugin uses the cache in the `disk-to-mirror` and `mirror-to-disk` workflows but does not use the cache in the `mirror-to-mirror` workflow. The plugin uses the cache to perform incremental mirroring and avoids remirroring unchanged images, which saves time and reduces network bandwidth usage.
12+
13+
The cache directory only contains data up to the last successful mirroring operation. If you delete or corrupt the cache directory, the oc-mirror plugin pulls the image blobs and manifests again, which can force a full remirror and increase network usage.
14+
15+
You can use the `--workspace` flag to specify a directory where the oc-mirror plugin stores the working files that it creates during a mirroring operation, such as the `ImageDigestMirrorSet` and `ImageTagMirrorSet` manifests. You can also use the workspace directory to perform the following actions:
16+
17+
* Store the untarred metadata for release and operator images.
18+
* Generate tar archives for use in `disk-to-mirror` workflows.
19+
* Apply the generated configuration to clusters.
20+
* Repeat or resume previous mirroring operations.
21+
22+
If you remove or modify the workspace directory, future mirroring operations might fail, or clusters may use inconsistent image sources.
23+
24+
[WARNING]
25+
====
26+
Deleting or modifying the contents of cache or workspace directories can cause the following issues:
27+
28+
* Failed or incomplete mirroring operations.
29+
* Loss of incremental mirroring data.
30+
* Full remirroring requirements and increased network overhead.
31+
32+
Do not modify, relocate, or delete these directories unless you fully understand the impact. You must regularly back up the cache directory after successful mirroring operations. It is not necessary to back up the workspace directory because its contents are regenerated during each mirroring cycle.
33+
====
34+
35+
Consider the following best practices so that you can better manage the cache and workspace directories effectively:
36+
37+
* Use persistent storage: Place the cache and workspace directories on reliable and backed‑up storage.
38+
* Back up after successful operations: Regularly back up the cache directory, especially after completing a mirroring cycle.
39+
* Restore when needed: In case of data loss, restore the cache and workspace directories from backup to resume mirroring operations without performing a full remirror.
40+
* Separate environments: Use dedicated directories for different environments to prevent conflicts.
41+
42+
Use the following example to specify the cache and workspace directories when running the oc-mirror command:
43+
44+
[source,terminal]
45+
----
46+
$ oc mirror --config=imageset-config.yaml \
47+
file://local_mirror \
48+
--workspace /mnt/mirror-data/workspace \
49+
--cache-dir /mnt/mirror-data/cache
50+
--v2
51+
----
52+
53+
After the mirroring operation completes, your directory structure is as follows:
54+
55+
[source,text]
56+
----
57+
/mnt/mirror-data/
58+
├── cache/
59+
│ ├── manifests/
60+
│ ├── metadata.db
61+
│ └── previous-mirror-state.json
62+
└── workspace/
63+
├── imageset-config-state.yaml
64+
├── manifests/
65+
└── icsp/
66+
----
67+
You must back up the `/mnt/mirror-data/cache` directory after each successful mirroring operation.
68+

modules/oc-mirror-command-reference-v2-delete.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The following tables describe the `oc mirror` subcommands and flags for deleting
1919
|Path of the authentication file. The default value is `${XDG_RUNTIME_DIR}/containers/auth.json`.
2020

2121
|`--cache-dir <string>`
22-
|oc-mirror cache directory location. The default is `$HOME`.
22+
|Use this flag to specify a directory where the oc-mirror plugin stores a persistent cache of image blobs and manifests for use during mirroring operations. The oc-mirror plugin uses the cache in the `disk-to-mirror` and `mirror-to-disk` workflows but does not use the cache in the `mirror-to-mirror` workflow. The plugin uses the cache to perform incremental mirroring and avoids remirroring unchanged images, which saves time and reduces network bandwidth usage. The default cache directory is `$HOME`. For more information, see "About the --cache-dir and --workspace flags".
2323

2424
|`-c <string>`, `--config <string>`
2525
|Path to the delete imageset configuration file.
@@ -67,6 +67,6 @@ The following tables describe the `oc mirror` subcommands and flags for deleting
6767
|Require HTTPS and verify certificates when talking to the container registry or daemon. The default value is `true`.
6868

6969
|`--workspace <string>`
70-
|oc-mirror workspace where resources and internal artifacts are generated.
70+
|You can use the `--workspace` flag to specify a directory where the oc-mirror plugin stores the working files that it creates during a mirroring operation, such as the `ImageDigestMirrorSet` and `ImageTagMirrorSet` manifests. Use this directory to apply the generated configuration to clusters and repeat mirroring operations. For more information, see "About the --cache-dir and --workspace flags".
7171

7272
|===

modules/oc-mirror-command-reference-v2.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The following tables describe the `oc mirror` subcommands and flags for oc-mirro
3939
|Specifies the path to an image set configuration file.
4040

4141
|`--cache-dir <string>`
42-
|oc-mirror cache directory location. The default value is `$HOME`.
42+
|Use this flag to specify a directory where the oc-mirror plugin stores a persistent cache of image blobs and manifests for use during mirroring operations. The oc-mirror plugin uses the cache in the `disk-to-mirror` and `mirror-to-disk` workflows but does not use the cache in the `mirror-to-mirror` workflow. The plugin uses the cache to perform incremental mirroring and avoids remirroring unchanged images, which saves time and reduces network bandwidth usage. The default cache directory is `$HOME`. For more information, see "About the --cache-dir and --workspace flags".
4343

4444
|`--dest-tls-verify`
4545
|Requires HTTPS and verifies certificates when accessing the container registry or daemon. The default value is `true`.
@@ -87,7 +87,7 @@ The following tables describe the `oc mirror` subcommands and flags for oc-mirro
8787
|Displays the version for oc-mirror plugin v2.
8888

8989
|`--workspace`
90-
|Determines string oc-mirror plugin v2 workspace where resources and internal artifacts are generated.
90+
|You can use the `--workspace` flag to specify a directory where the oc-mirror plugin stores the working files that it creates during a mirroring operation, such as the `ImageDigestMirrorSet` and `ImageTagMirrorSet` manifests. Use this directory to apply the generated configuration to clusters and repeat mirroring operations. For more information, see "About the --cache-dir and --workspace flags".
9191

9292
|`--retry-delay duration`
9393
|Delay between 2 retries. The default value is `1s`.

0 commit comments

Comments
 (0)