Skip to content

OpenShiftP-633: Convert oc adm release mirror usage to oc-mirror v2#336

Open
mpkredhat wants to merge 1 commit into
redhat-cop:mainfrom
mpkredhat:br-633
Open

OpenShiftP-633: Convert oc adm release mirror usage to oc-mirror v2#336
mpkredhat wants to merge 1 commit into
redhat-cop:mainfrom
mpkredhat:br-633

Conversation

@mpkredhat

Copy link
Copy Markdown

This PR is for replacing "oc adm release mirror" command with "oc-mirror --v2" in disconnected installations.
This step is part of disconnected changes to get inline with current mirroring best practices.
Corresponding Redhat issue : https://issues.redhat.com/browse/OCPBUGS-70297

@mpkredhat mpkredhat force-pushed the br-633 branch 2 times, most recently from e47c800 to 6fbc4b7 Compare April 13, 2026 13:17
Comment thread tasks/main.yml Outdated
- name: Downloading oc-mirror package
get_url:
url: "{{ oc_mirror_source }}"
dest: /usr/local/bin/oc-mirror.tar.gz

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dest: /usr/local/bin/oc-mirror.tar.gz
dest: /usr/local/src/oc-mirror.tar.gz

Comment thread tasks/main.yml Outdated

- name: Unarchiving oc-mirror package
unarchive:
src: /usr/local/bin/oc-mirror.tar.gz

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
src: /usr/local/bin/oc-mirror.tar.gz
src: /usr/local/src/oc-mirror.tar.gz

Comment thread vars/main.yml Outdated
Comment on lines +41 to +43
ocp_channel_name: stable-4.20
ocp_min_version: 4.20.2
ocp_max_version: 4.20.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting looks wrong, the L32 in original is offset 2 chars, you lost the integrity of setup_registry

Comment thread templates/imageset-config.yaml.j2 Outdated
mirror:
platform:
architectures:
- "{{ ansible_architecture }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to come from openshift-install version if it contains multi, then set, else use ansible_architecture

Comment thread vars/main.yml Outdated
ocp_install_kernel: "https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/4.9/4.9.0/rhcos-4.9.0-x86_64-live-kernel-x86_64"
ocp_client: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.9.18/openshift-client-linux-4.9.18.tar.gz"
ocp_installer: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.9.18/openshift-install-linux-4.9.18.tar.gz"
oc_mirror_source: "https://mirror.openshift.com/pub/openshift-v4/ppc64le/clients/ocp/stable-4.20/oc-mirror.tar.gz"

@prb112 prb112 Apr 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
oc_mirror_source: "https://mirror.openshift.com/pub/openshift-v4/ppc64le/clients/ocp/stable-4.20/oc-mirror.tar.gz"
oc_mirror: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.20/oc-mirror.tar.gz"

match the style

Comment thread tasks/setup_registry.yaml
when:
- setup_registry.autosync_registry
- (((ocp_version.stdout.split(' ')[0] | int ) >= 4 and (ocp_version.stdout.split(' ')[1] | int) > 19 ) or ((ocp_version.stdout.split(' ')[0] | int ) >= 5 ))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a step that deletes the cache. by default is is disabled. We will only use this in CI.

Comment thread tasks/main.yml Outdated
- name: Copy ImageSetConfig file
template:
src: ../templates/imageset-config.yaml.j2
dest: /usr/local/src/imageset-config.yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this configuration in /etc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this step to setup_registry.yaml

@prb112 prb112 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor changes...

@mpkredhat mpkredhat force-pushed the br-633 branch 2 times, most recently from 92792d7 to 357c01a Compare April 16, 2026 12:53
Comment thread tasks/setup_registry.yaml Outdated
owner: root
group: root

- name: Get openshift-install architecture

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Get openshift-install architecture
- name: Get openshift-install payload architecture

Comment thread tasks/setup_registry.yaml Outdated
Comment on lines +98 to +107
imageset_arch: >-
{{
['amd64', 'arm64', 'ppc64le', 's390x']
if os_install_arch.stdout == 'multi'
else
[os_install_arch.stdout]
if os_install_arch.rc == 0 and os_install_arch.stdout | length > 0
else
['amd64']
}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are telling it to mirror every payload ['amd64', 'arm64', 'ppc64le', 's390x']
We only care about the arch specified or multi not the branching.

Comment thread tasks/setup_registry.yaml Outdated
- name: Copy ImageSetConfig file
template:
src: ../templates/imageset-config.yaml.j2
dest: /etc/imageset-config.yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's prefix with oc-mirror_

Suggested change
dest: /etc/imageset-config.yaml
dest: /etc/oc-mirror_imageset-config.yaml

@mpkredhat mpkredhat force-pushed the br-633 branch 15 times, most recently from ac2b9e3 to e188bd7 Compare April 23, 2026 10:15
@mpkredhat mpkredhat force-pushed the br-633 branch 4 times, most recently from f30631b to 8798ac6 Compare April 24, 2026 18:06
Comment thread tasks/setup_registry.yaml
Comment on lines 271 to 275
- name: Generate Local Registry information
when: setup_registry.autosync_registry
copy:
content: "{{ registry.stdout }}"
content: "{{ registry.stdout_lines }}"
dest: ../postrun-local-registry-info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we don't need it. However, we shouldn't mutate the original intent with this code. Right?

It'd change the behavior of the existing installations. I'd recommend excluding it when running oc-mirror.

Comment thread tasks/setup_registry.yaml
Comment on lines 277 to 280
- name: Process Local Registry information
when: setup_registry.autosync_registry
shell: "sed -i '1,/Success/d' ../postrun-local-registry-info"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be used in many palces.

@mpkredhat mpkredhat force-pushed the br-633 branch 4 times, most recently from 782021e to d537536 Compare April 28, 2026 12:54
Comment thread vars/main.yml Outdated
oc_mirror_bin: "oc-mirror"
oc_mirror_cmd: "/usr/local/bin/oc-mirror"
oc_mirror_wipe_cache: false
oc_mirror_workspace_dir: /tmp/oc-mirror-work-dir

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not what we want to use. oc_mirror_workspace_dir: /tmp/oc-mirror-work-dir - we need to use the home folder or /var/oc-mirror.

RHEL uses systemd-tmpfiles to automatically prune files from /tmp. Unlike some distributions that only clear /tmp on reboot, RHEL will delete files while the system is running if they haven't been accessed for a certain amount of time.

Comment thread vars/main.yml
oc_mirror_bin: "oc-mirror"
oc_mirror_cmd: "/usr/local/bin/oc-mirror"
oc_mirror_wipe_cache: false
oc_mirror_workspace_dir: /var/oc-mirror-work-dir

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@mpkredhat mpkredhat force-pushed the br-633 branch 3 times, most recently from 8aff9aa to d777576 Compare May 12, 2026 14:01
@mpkredhat mpkredhat force-pushed the br-633 branch 8 times, most recently from 4732d61 to 22d83a2 Compare June 24, 2026 08:43
Comment thread vars/main.yml
Comment on lines -30 to -32
ocp_channel_name: "stable-4.20"
ocp_min_version: "4.20.2"
ocp_max_version: "4.20.2"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't mutate the existing values and locations. It should only be changed when / if it is discussed and coordinate. Please revert these moves.

Comment thread vars/main.yml
Comment on lines +40 to +45
oc_mirror_parallel_images: 10
oc_mirror_parallel_layers: 10
oc_mirror_bin: "oc-mirror"
oc_mirror_cmd: "/usr/local/bin/oc-mirror"
oc_mirror_wipe_cache: false
oc_mirror_workspace_dir: /var/oc-mirror-work-dir

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These make sense here

Signed-off-by: Mandar Kulkarni <mandar.kulkarni6@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants