Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions roles/openshift_setup/tasks/configure_registries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,65 @@
spec:
imageDigestMirrors: "{{ cifmw_openshift_setup_digest_mirrors }}"

- name: Add catalog registry credentials to cluster pull-secret
when:
- cifmw_catalog_manifest is defined
- cifmw_catalog_manifest | length > 0
- cifmw_openshift_setup_catalog_registry_credentials is defined
no_log: true
block:
- name: Get current cluster pull-secret
kubernetes.core.k8s_info:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
api_key: "{{ cifmw_openshift_token | default(omit) }}"
context: "{{ cifmw_openshift_context | default(omit) }}"
kind: Secret
name: pull-secret
namespace: openshift-config
register: _cluster_pull_secret

- name: Merge catalog registry auth into cluster pull-secret
vars:
_current_auths: >-
{{
(_cluster_pull_secret.resources[0].data['.dockerconfigjson']
| b64decode | from_json).auths
}}
_catalog_auth:
"{{ cifmw_openshift_setup_catalog_registry_credentials.registry }}":
auth: >-
{{
(cifmw_openshift_setup_catalog_registry_credentials.username ~ ':'
~ cifmw_openshift_setup_catalog_registry_credentials.password)
| b64encode
}}
_merged:
auths: "{{ _current_auths | combine(_catalog_auth) }}"
kubernetes.core.k8s:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
api_key: "{{ cifmw_openshift_token | default(omit) }}"
context: "{{ cifmw_openshift_context | default(omit) }}"
state: present
definition:
apiVersion: v1
kind: Secret
metadata:
name: pull-secret
namespace: openshift-config
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: "{{ _merged | to_json | b64encode }}"

- name: Create CatalogSource for OpenStack operators
when:
- cifmw_catalog_manifest is defined
- cifmw_catalog_manifest | length > 0
kubernetes.core.k8s:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
api_key: "{{ cifmw_openshift_token | default(omit)}}"
context: "{{ cifmw_openshift_context | default(omit)}}"
definition: "{{ cifmw_catalog_manifest }}"

# If both ImageDigestMirrorSet and ImageTagMirrorSet are applied to the registries,
# ITMS acts as a fallback for tag-based pulls, while IDMS provides the primary
# secure source for digests
Expand Down
Loading