Skip to content

Commit 900488d

Browse files
authored
AGENT-744: agent e2e tests support (#1602)
* use local registry certificate for connected scenarios Since the CI e2e step enables by default dev-scripts local registry to store specific CI test images, it's required to configure install-config.yaml with the registry certificate when the registry it's enabled (and this could happen even when MIRROR_IMAGES wasn't set) * Adding missing bits to support CI e2e test execution
1 parent e4f2100 commit 900488d

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

agent/06_agent_create_cluster.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,25 @@ wait_for_cluster_ready
406406
if [ ! -z "${AGENT_DEPLOY_MCE}" ]; then
407407
mce_complete_deployment
408408
fi
409+
410+
# e2e test configuration
411+
412+
# Configure storage for the image registry
413+
oc patch configs.imageregistry.operator.openshift.io \
414+
cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}},"managementState":"Managed"}}'
415+
416+
if [[ ! -z "${ENABLE_LOCAL_REGISTRY}" ]]; then
417+
# Configure tools image registry and cluster samples operator
418+
# when local image stream is enabled. These are basically to run CI tests
419+
# depend on tools image.
420+
add_local_certificate_as_trusted
421+
fi
422+
423+
# Marketplace operators could not pull their images via internet
424+
# and stays degraded in disconnected.
425+
# This is the suggested way in
426+
# https://docs.openshift.com/container-platform/4.9/operators/admin/olm-managing-custom-catalogs.html#olm-restricted-networks-operatorhub_olm-managing-custom-catalogs
427+
if [[ -n "${MIRROR_IMAGES}" ]]; then
428+
oc patch OperatorHub cluster --type json \
429+
-p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
430+
fi

agent/roles/manifests/tasks/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
- name: Get additional trust bundle
22
set_fact:
33
ca_bundle_crt: "{{ lookup('file', mirror_path + '/ca-bundle.crt') | to_json }}"
4-
when: mirror_images
4+
when: mirror_images
5+
6+
- name: Get local registry certificate
7+
set_fact:
8+
registry_certificate: "{{ lookup('file', registry_dir + '/certs/' + registry_crt) | to_json }}"
9+
when: enable_local_registry
510

611
- name: Set GoCPUArchitecture
712
set_fact:

agent/roles/manifests/templates/install-config_yaml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ imageContentSources:
8585
source: "registry.redhat.io/redhat"
8686
{% endif %}
8787
additionalTrustBundle: {{ ca_bundle_crt }}
88+
{% elif enable_local_registry %}
89+
additionalTrustBundle: {{ registry_certificate }}
8890
{% endif %}

agent/roles/manifests/vars/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cluster_name: "{{ lookup('env', 'CLUSTER_NAME') }}"
1616
cluster_namespace: "{{ lookup('env', 'CLUSTER_NAMESPACE') }}"
1717
cluster_subnet_v4: "{{ lookup('env', 'CLUSTER_SUBNET_V4') }}"
1818
cluster_subnet_v6: "{{ lookup('env', 'CLUSTER_SUBNET_V6') }}"
19+
enable_local_registry: "{{ lookup('env', 'ENABLE_LOCAL_REGISTRY') != '' }}"
1920
external_subnet_v4: "{{ lookup('env', 'EXTERNAL_SUBNET_V4') }}"
2021
external_subnet_v6: "{{ lookup('env', 'EXTERNAL_SUBNET_V6') }}"
2122
external_subnet_v4_prefixlen: "{{ lookup('env', 'EXTERNAL_SUBNET_V4') | ansible.utils.ipaddr('prefix') }}"
@@ -40,6 +41,8 @@ provisioning_host_external_ip: "{{ lookup('env', 'PROVISIONING_HOST_EXTERNAL_IP'
4041
pull_secret: "{{ lookup('env', 'PULL_SECRET_FILE') }}"
4142
pull_secret_contents: "{{ lookup('file', pull_secret) | to_json }}"
4243
pxe_server_url: "{{ lookup('env', 'PXE_SERVER_URL')}}"
44+
registry_crt: "{{ lookup('env', 'REGISTRY_CRT')}}"
45+
registry_dir: "{{ lookup('env', 'REGISTRY_DIR')}}"
4346
ssh_pub_key: "{{ lookup('env', 'SSH_PUB_KEY') }}"
4447
service_subnet_v4: "{{ lookup('env', 'SERVICE_SUBNET_V4') }}"
4548
service_subnet_v6: "{{ lookup('env', 'SERVICE_SUBNET_V6') }}"

0 commit comments

Comments
 (0)