Skip to content

Commit dba4fb0

Browse files
committed
OSDOCS#13788: Added info for cache and workspace directories in oc-mirror doc
1 parent 1fa0ad8 commit dba4fb0

File tree

4 files changed

+88
-4
lines changed

4 files changed

+88
-4
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,21 @@ include::modules/oc-mirror-imageset-config-parameters-v2.adoc[leveloffset=+1]
130130

131131
// Command reference for oc-mirror v2
132132
include::modules/oc-mirror-command-reference-v2.adoc[leveloffset=+1]
133+
134+
[role="_additional-resources"]
135+
.Additional resources
136+
137+
* xref:../../disconnected/mirroring/about-installing-oc-mirror-v2.adoc#oc-mirror-about-cache-and-workspace-dirs_about-installing-oc-mirror-v2[About the --cache-dir and --workspace flags]
138+
133139
include::modules/oc-mirror-command-reference-v2-delete.adoc[leveloffset=+2]
134140

141+
[role="_additional-resources"]
142+
.Additional resources
143+
144+
* xref:../../disconnected/mirroring/about-installing-oc-mirror-v2.adoc#oc-mirror-about-cache-and-workspace-dirs_about-installing-oc-mirror-v2[About the --cache-dir and --workspace flags]
145+
146+
include::modules/oc-mirror-about-cache-and-workspace-dirs.adoc[leveloffset=+2]
147+
135148
[role="_additional-resources"]
136149
.Additional resources
137150
* xref:../../disconnected/mirroring/about-installing-oc-mirror-v2.adoc#oc-mirror-updating-cluster-manifests-v2_about-installing-oc-mirror-v2[Configuring your cluster to use the resources generated by oc-mirror]
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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 it creates during a mirroring operation, such as the ImageDigestMirrorSet and ImageTagMirrorSet manifests.
16+
17+
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:
18+
19+
* Store the untarred metadata for release and operator images.
20+
* Generate tar archives for use in `disk-to-mirror` workflows.
21+
* Apply the generated configuration to clusters.
22+
* Repeat or resume previous mirroring operations.
23+
24+
If you remove or modify the workspace directory, future mirroring operations might fail, or clusters may use inconsistent image sources.
25+
26+
[WARNING]
27+
====
28+
Deleting or modifying the contents of cache or workspace directories can cause the following issues:
29+
30+
* Failed or incomplete mirroring operations.
31+
* Loss of incremental mirroring data.
32+
* Full remirroring requirements and increased network overhead.
33+
34+
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.
35+
====
36+
37+
The following best practices help you manage the cache and workspace directories effectively:
38+
39+
* Use persistent storage: Place the cache and workspace directories on reliable and backed‑up storage.
40+
* Back up after successful operations: Regularly back up the cache directory, especially after completing a mirroring cycle.
41+
* 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.
42+
* Separate environments: Use dedicated directories for different environments to prevent conflicts.
43+
44+
.Using cache and workspace directories
45+
====
46+
Specify the cache and workspace directories by running the following command:
47+
[source,terminal]
48+
----
49+
$ oc mirror --config=imageset-config.yaml \
50+
file://local_mirror \
51+
--workspace /mnt/mirror-data/workspace \
52+
--cache-dir /mnt/mirror-data/cache
53+
--v2
54+
----
55+
56+
Example directory structure after mirroring:
57+
----
58+
/mnt/mirror-data/
59+
├── cache/
60+
│ ├── manifests/
61+
│ ├── metadata.db
62+
│ └── previous-mirror-state.json
63+
└── workspace/
64+
├── imageset-config-state.yaml
65+
├── manifests/
66+
└── icsp/
67+
----
68+
69+
You must back up the `/mnt/mirror-data/cache` directory after each successful mirroring operation.
70+
====
71+

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)