Skip to content

Commit f2ab043

Browse files
rebtoorcursoragent
andcommitted
[openshift_setup] Apply CatalogSource from content-set catalog manifest
Apply cifmw_catalog_manifest so architecture-update jobs can install the OCP-aware index selected from the RHOSO content set. Related-Issue: #OSPCIX-1431 Closes: ANVIL-159 Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Roberto Alfieri <ralfieri@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 670f562 commit f2ab043

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

roles/openshift_setup/tasks/configure_registries.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,84 @@
5353
spec:
5454
imageDigestMirrors: "{{ cifmw_openshift_setup_digest_mirrors }}"
5555

56+
- name: Add catalog registry credentials to cluster pull-secret
57+
when:
58+
- cifmw_openshift_setup_catalog_registry_credentials is defined
59+
- cifmw_openshift_setup_catalog_registry_credentials | length > 0
60+
no_log: true
61+
block:
62+
- name: Get current cluster pull-secret
63+
kubernetes.core.k8s_info:
64+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
65+
api_key: "{{ cifmw_openshift_token | default(omit) }}"
66+
context: "{{ cifmw_openshift_context | default(omit) }}"
67+
kind: Secret
68+
name: pull-secret
69+
namespace: openshift-config
70+
register: _cluster_pull_secret
71+
72+
- name: Merge catalog registry auth into cluster pull-secret
73+
vars:
74+
_current_auths: >-
75+
{{
76+
(_cluster_pull_secret.resources[0].data['.dockerconfigjson']
77+
| b64decode | from_json).auths
78+
}}
79+
_catalog_auth:
80+
"{{ cifmw_openshift_setup_catalog_registry_credentials.registry }}":
81+
auth: >-
82+
{{
83+
(cifmw_openshift_setup_catalog_registry_credentials.username ~ ':'
84+
~ cifmw_openshift_setup_catalog_registry_credentials.password)
85+
| b64encode
86+
}}
87+
_merged:
88+
auths: "{{ _current_auths | combine(_catalog_auth) }}"
89+
kubernetes.core.k8s:
90+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
91+
api_key: "{{ cifmw_openshift_token | default(omit) }}"
92+
context: "{{ cifmw_openshift_context | default(omit) }}"
93+
state: present
94+
definition:
95+
apiVersion: v1
96+
kind: Secret
97+
metadata:
98+
name: pull-secret
99+
namespace: openshift-config
100+
type: kubernetes.io/dockerconfigjson
101+
data:
102+
.dockerconfigjson: "{{ _merged | to_json | b64encode }}"
103+
104+
- name: Wait for MachineConfigPools to settle after registry changes
105+
when:
106+
- cifmw_openshift_setup_digest_mirrors is defined
107+
- cifmw_openshift_setup_digest_mirrors | length > 0
108+
environment:
109+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
110+
PATH: "{{ cifmw_path }}"
111+
ansible.builtin.shell:
112+
cmd: |
113+
set -eo pipefail
114+
MCP_JSON=$(oc get mcp -o json)
115+
UPDATING=$(echo "$MCP_JSON" | jq -r '
116+
.items[] |
117+
select(
118+
.status.conditions // [] |
119+
map(select(.type == "Updating" and .status == "True")) |
120+
length > 0
121+
) | .metadata.name')
122+
if [ -z "$UPDATING" ]; then
123+
echo "All MCPs settled."
124+
exit 0
125+
fi
126+
echo "MCPs still updating: $UPDATING"
127+
exit 1
128+
register: _mcp_settle
129+
until: _mcp_settle.rc == 0
130+
retries: 60
131+
delay: 30
132+
changed_when: false
133+
56134
# If both ImageDigestMirrorSet and ImageTagMirrorSet are applied to the registries,
57135
# ITMS acts as a fallback for tag-based pulls, while IDMS provides the primary
58136
# secure source for digests

0 commit comments

Comments
 (0)