Skip to content

Commit

Permalink
Add support to specify a registry repository and nightlies registry
Browse files Browse the repository at this point in the history
Currently the registry repository is hardcoded to the default
ocp4/openshift4, this patch includes a variable to customize it,
the default is still ocp4/openshift4. Also a registry entry for
OCP nightlies version is included.
  • Loading branch information
manurodriguez committed Sep 7, 2023
1 parent 479a368 commit 5a38b4b
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
2 changes: 2 additions & 0 deletions inventory.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ all:
ansible_host: registry.example.lab
registry_port: 5000
registry_fqdn: registry.example.lab # use in case of different FQDN for the cert
registry_namespace: ocp4 # This is the default, use only in case the registry namespace name is different
registry_image: openshift4 # This is the default, use only in case the registry image name is different
cert_common_name: "{{ registry_fqdn }}"
cert_country: US
cert_locality: Raleigh
Expand Down
3 changes: 3 additions & 0 deletions roles/generate_discovery_iso/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ upload: False

disconnected: "{{ use_local_mirror_registry | default(setup_registry_service | default(true)) }}"
mirror_registry: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_port'] }}"
ocp_registry_namespace: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_namespace'] | default('ocp4') }}"
ocp_registry_image: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_image'] | default('openshift4') }}"
registry_repository: "{{ ocp_registry_namespace }}/{{ ocp_registry_image }}"

ASSISTED_INSTALLER_HOST: "{{ hostvars['assisted_installer']['host'] | default(ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0])) }}"
ASSISTED_INSTALLER_PORT: "{{ hostvars['assisted_installer']['port'] | default(8090) }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ unqualified-search-registries = ["registry.access.redhat.com", "docker.io"]
location = "quay.io/openshift-release-dev/ocp-release"
mirror-by-digest-only = true
[[registry.mirror]]
location = "{{ mirror_registry }}/ocp4/openshift4"
location = "{{ mirror_registry }}/{{ registry_repository }}"
[[registry]]
prefix = ""
location = "registry.ci.openshift.org/ocp/release"
mirror-by-digest-only = true
[[registry.mirror]]
location = "{{ mirror_registry }}/{{ registry_repository }}"
[[registry]]
prefix = ""
location = "quay.io/openshift-release-dev/ocp-v4.0-art-dev"
mirror-by-digest-only = true
[[registry.mirror]]
location = "{{ mirror_registry }}/ocp4/openshift4"
location = "{{ mirror_registry }}/{{ registry_repository }}"
3 changes: 3 additions & 0 deletions roles/generate_manifests/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ arch: x86_64
version_filter: "[?(openshift_version == '{{ openshift_version }}') && (cpu_architecture == '{{ arch }}')]"
release_image: "{{ (assisted_installer_release_images | json_query(version_filter))[0].url }}"
mirror_registry: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_port'] }}"
ocp_registry_namespace: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_namespace'] | default('ocp4') }}"
ocp_registry_image: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_image'] | default('openshift4') }}"
registry_repository: "{{ ocp_registry_namespace }}/{{ ocp_registry_image }}"
agent_based_installer_bootstrap_node: "{{ groups['masters'][0] }}"
host_ip_keyword: ansible_host
use_local_mirror_registry: "{{ setup_registry_service | default(true) }}"
Expand Down
7 changes: 5 additions & 2 deletions roles/generate_manifests/templates/registry-config.j2
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
imageContentSources:
- source: quay.io/openshift-release-dev/ocp-release
mirrors:
- {{ mirror_registry }}/ocp4/openshift4
- {{ mirror_registry }}/{{ registry_repository }}
- source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
mirrors:
- {{ mirror_registry }}/ocp4/openshift4
- {{ mirror_registry }}/{{ registry_repository }}
- source: registry.ci.openshift.org/ocp/release
mirrors:
- {{ mirror_registry }}/{{ registry_repository }}
- source: quay.io/edge-infrastructure
mirrors:
- {{ mirror_registry }}/ocpmetal
Expand Down
3 changes: 3 additions & 0 deletions roles/patch_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ fetched_dest: "{{ repo_root_path }}/fetched"

disconnected: "{{ use_local_mirror_registry | default(setup_registry_service | default(true)) }}"
mirror_registry: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_port'] }}"
ocp_registry_namespace: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_namespace'] | default('ocp4') }}"
ocp_registry_image: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_image'] | default('openshift4') }}"
registry_repository: "{{ ocp_registry_namespace }}/{{ ocp_registry_image }}"

ASSISTED_INSTALLER_HOST: "{{ hostvars['assisted_installer']['host'] | default(ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0])) }}"
ASSISTED_INSTALLER_PORT: "{{ hostvars['assisted_installer']['port'] | default(8090) }}"
Expand Down
7 changes: 5 additions & 2 deletions roles/patch_cluster/templates/patch-install-config.j2
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
imageContentSources:
- mirrors:
- {{ mirror_registry }}/ocp4/openshift4
- {{ mirror_registry }}/{{ registry_repository }}
source: quay.io/openshift-release-dev/ocp-release
- mirrors:
- {{ mirror_registry }}/ocp4/openshift4
- {{ mirror_registry }}/{{ registry_repository }}
source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
- mirrors:
- {{ mirror_registry }}/{{ registry_repository }}
source: registry.ci.openshift.org/ocp/release
- mirrors:
- {{ mirror_registry }}/ocpmetal
source: quay.io/edge-infrastructure
Expand Down
7 changes: 5 additions & 2 deletions roles/populate_mirror_registry/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ stable_opm_tar: "opm-linux.tar.gz"
registry_fqdn: "{{ ansible_fqdn }}"
local_registry: "{{ registry_fqdn }}:{{ registry_port }}"
registry_port: 5000
ocp_registry_namespace: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_namespace'] | default('ocp4') }}"
ocp_registry_image: "{{ hostvars['registry_host']['registry_fqdn'] }}:{{ hostvars['registry_host']['registry_image'] | default('openshift4') }}"
registry_repository: "{{ ocp_registry_namespace }}/{{ ocp_registry_image }} "

installer_agent_image:
remote: "quay.io/edge-infrastructure/assisted-installer-agent@{{ image_hashes.installer_agent }}"
Expand All @@ -49,14 +52,14 @@ release_image_remote: "quay.io/openshift-release-dev/ocp-release"

release_image_item:
remote: "{{ release_image_remote }}@{{ image_hashes['release_' + (openshift_full_version | string) + '_x86_64'] }}"
local: "{{ local_registry }}/ocp4/openshift4"
local: "{{ local_registry }}/{{ registry_repository }}"
local_tag: "{{ openshift_full_version }}-x86_64"

arm_release_image_key: "release_{{ openshift_full_version | string }}_arm64"

release_image_item_arm:
remote: "{{ release_image_remote }}@{{ image_hashes[arm_release_image_key] }}"
local: "{{ local_registry }}/ocp4/openshift4"
local: "{{ local_registry }}/{{ registry_repository }}"
local_tag: "{{ openshift_full_version }}-aarch64"

olm_index_item:
Expand Down

0 comments on commit 5a38b4b

Please sign in to comment.