Skip to content

Commit

Permalink
Architecture repository test playbook
Browse files Browse the repository at this point in the history
The architecture repository needs some more testing. This playbook
allows to use the ci-framework "flexible loop" in order to ensure we
can:
- load the files (all of them)
- loop on the automation steps
- generate all the needed content (via ci_gen_kustomize_values)
- build final CRs with all the data

This is mostly a "read-only", "linting-like" check, and does NOT apply
the CRs.
  • Loading branch information
cjeanner authored and openshift-merge-bot[bot] committed May 16, 2024
1 parent 407bde2 commit d862c8b
Show file tree
Hide file tree
Showing 7 changed files with 614 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,28 @@ check_zuul_files: role_molecule ## Regenerate zuul files and check if they have
check_k8s_snippets_comment: ## Check template snippets in ci_gen_kustomize_values to ensure proper source is set
./scripts/check_k8s_snippets_comment.sh 2>&1 | ansi2txt | tee $(LOG_DIR)/check_k8s_snippets_comment.log

##@ Architecture tests
.PHONY: architecture_test
architecture_test: setup_tests architecture_test_nodeps ## Runs architecture-test with dependencies install

.PHONY: architecture_test_nodeps
architecture_test_nodeps: export PATH=/tmp/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin
architecture_test_nodeps:
$(call check-var-defined,SCENARIO_NAME)
$(call check-var-defined,ARCH_REPO)
$(call check-var-defined,NET_ENV_FILE)
cp -r ${ARCH_REPO} /tmp/local-arch-repo;
ansible-playbook -i localhost, -c local \
/install_yamls/devsetup/download_tools.yaml \
--tags kubectl,kustomize;
ansible-playbook -i localhost, -c local \
ci/playbooks/validate-architecture.yml \
-e cifmw_zuul_target_host=localhost \
-e ansible_user_dir=/tmp \
-e cifmw_architecture_repo=/tmp/local-arch-repo \
-e cifmw_architecture_scenario=${SCENARIO_NAME} \
-e cifmw_networking_mapper_networking_env_def_path=${NET_ENV_FILE}

##@ Ansible-test testing
.PHONY: ansible_test
ansible_test: setup_tests ansible_test_nodeps ## Runs ansible-test with dependencies install
Expand Down Expand Up @@ -146,6 +168,25 @@ run_ctx_ansible_test: ci_ctx ## Run molecule check in a container
-e ANSIBLE_REMOTE_TMP=/tmp \
${CI_CTX_NAME} bash -c "make ansible_test_nodeps" ;

.PHONY: run_ctx_architecture_test
run_ctx_architecture_test: ## Run architecture_test in a container
$(call check-var-defined,SCENARIO_NAME)
$(call check-var-defined,ARCH_REPO)
$(call check-var-defined,INSTALL_YAMLS_REPO)
$(call check-var-defined,NET_ENV_FILE)
@$(MAKE) ci_ctx
podman run --rm --security-opt label=disable -v .:/opt/sources \
-e HOME=/tmp \
-e ANSIBLE_LOCAL_TMP=/tmp \
-e ANSIBLE_REMOTE_TMP=/tmp \
-e SCENARIO_NAME=${SCENARIO_NAME} \
-e ARCH_REPO=/architecture \
-e NET_ENV_FILE=/net-env-file.yml \
-v ${ARCH_REPO}:/architecture:ro \
-v ${NET_ENV_FILE}:/net-env-file.yml:ro \
-v ${INSTALL_YAMLS_REPO}:/install_yamls:ro \
${CI_CTX_NAME} bash -c "make architecture_test_nodeps" ;

.PHONY: enable-git-hooks
enable-git-hooks:
git config core.hooksPath "./.githooks"
Expand Down
337 changes: 337 additions & 0 deletions ci/playbooks/files/networking-env-definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,337 @@
instances:
compute-0:
hostname: compute-0
name: compute-0
networks:
ctlplane:
interface_name: eth1
ip_v4: 192.168.122.100
mac_addr: '52:54:00:17:05:43'
mtu: 1500
network_name: ctlplane
skip_nm: false
internalapi:
interface_name: eth1.20
ip_v4: 172.17.0.100
mac_addr: '52:54:00:05:da:ef'
mtu: 1500
network_name: internalapi
parent_interface: eth1
skip_nm: false
vlan_id: 20
storage:
interface_name: eth1.21
ip_v4: 172.18.0.100
mac_addr: '52:54:00:59:8a:4c'
mtu: 1500
network_name: storage
parent_interface: eth1
skip_nm: false
vlan_id: 21
tenant:
interface_name: eth1.22
ip_v4: 172.19.0.100
mac_addr: '52:54:00:0b:1c:d7'
mtu: 1500
network_name: tenant
parent_interface: eth1
skip_nm: false
vlan_id: 22
controller-0:
hostname: controller-0
name: controller-0
networks:
ctlplane:
interface_name: eth1
ip_v4: 192.168.122.9
mac_addr: '0a:02:a0:63:cb:1c'
mtu: 1500
network_name: ctlplane
skip_nm: false
ocp-master-0:
hostname: ocp-master-0
name: ocp-master-0
networks:
ctlplane:
interface_name: enp6s0
ip_v4: 192.168.122.10
mac_addr: '0a:02:ca:be:0b:38'
mtu: 1500
network_name: ctlplane
skip_nm: false
internalapi:
interface_name: enp6s0.20
ip_v4: 172.17.0.10
mac_addr: '52:54:00:1b:6e:a3'
mtu: 1500
network_name: internalapi
parent_interface: enp6s0
skip_nm: false
vlan_id: 20
storage:
interface_name: enp6s0.21
ip_v4: 172.18.0.10
mac_addr: '52:54:00:56:fa:88'
mtu: 1500
network_name: storage
parent_interface: enp6s0
skip_nm: false
vlan_id: 21
tenant:
interface_name: enp6s0.22
ip_v4: 172.19.0.10
mac_addr: '52:54:00:18:a0:f6'
mtu: 1500
network_name: tenant
parent_interface: enp6s0
skip_nm: false
vlan_id: 22
ocp-master-1:
hostname: ocp-master-1
name: ocp-master-1
networks:
ctlplane:
interface_name: enp6s0
ip_v4: 192.168.122.11
mac_addr: '0a:02:ca:be:0b:39'
mtu: 1500
network_name: ctlplane
skip_nm: false
internalapi:
interface_name: enp6s0.20
ip_v4: 172.17.0.11
mac_addr: '52:54:00:1b:6e:a4'
mtu: 1500
network_name: internalapi
parent_interface: enp6s0
skip_nm: false
vlan_id: 20
storage:
interface_name: enp6s0.21
ip_v4: 172.18.0.11
mac_addr: '52:54:00:56:fa:89'
mtu: 1500
network_name: storage
parent_interface: enp6s0
skip_nm: false
vlan_id: 21
tenant:
interface_name: enp6s0.22
ip_v4: 172.19.0.11
mac_addr: '52:54:00:18:a0:f7'
mtu: 1500
network_name: tenant
parent_interface: enp6s0
skip_nm: false
vlan_id: 22
ocp-master-2:
hostname: ocp-master-2
name: ocp-master-2
networks:
ctlplane:
interface_name: enp6s0
ip_v4: 192.168.122.12
mac_addr: '0a:02:ca:be:0b:40'
mtu: 1500
network_name: ctlplane
skip_nm: false
internalapi:
interface_name: enp6s0.20
ip_v4: 172.17.0.12
mac_addr: '52:54:00:1b:6e:a5'
mtu: 1500
network_name: internalapi
parent_interface: enp6s0
skip_nm: false
vlan_id: 20
storage:
interface_name: enp6s0.21
ip_v4: 172.18.0.12
mac_addr: '52:54:00:56:fa:90'
mtu: 1500
network_name: storage
parent_interface: enp6s0
skip_nm: false
vlan_id: 21
tenant:
interface_name: enp6s0.22
ip_v4: 172.19.0.12
mac_addr: '52:54:00:18:a0:f8'
mtu: 1500
network_name: tenant
parent_interface: enp6s0
skip_nm: false
vlan_id: 22
networks:
ctlplane:
dns_v4:
- 192.168.122.1
dns_v6: []
gw_v4: 192.168.122.1
mtu: 1500
network_name: ctlplane
network_v4: 192.168.122.0/24
search_domain: ctlplane.example.com
tools:
metallb:
ipv4_ranges:
- end: 192.168.122.90
end_host: 90
length: 11
start: 192.168.122.80
start_host: 80
ipv6_ranges: []
multus:
ipv4_ranges:
- end: 192.168.122.70
end_host: 70
length: 41
start: 192.168.122.30
start_host: 30
ipv6_ranges: []
netconfig:
ipv4_ranges:
- end: 192.168.122.120
end_host: 120
length: 21
start: 192.168.122.100
start_host: 100
- end: 192.168.122.200
end_host: 200
length: 51
start: 192.168.122.150
start_host: 150
ipv6_ranges: []
external:
dns_v4: []
dns_v6: []
mtu: 1500
network_name: external
network_v4: 10.0.0.0/24
search_domain: external.example.com
tools:
netconfig:
ipv4_ranges:
- end: 10.0.0.250
end_host: 250
length: 151
start: 10.0.0.100
start_host: 100
ipv6_ranges: []
vlan_id: 22
internalapi:
dns_v4: []
dns_v6: []
mtu: 1496
network_name: internalapi
network_v4: 172.17.0.0/24
search_domain: internalapi.example.com
tools:
metallb:
ipv4_ranges:
- end: 172.17.0.90
end_host: 90
length: 11
start: 172.17.0.80
start_host: 80
ipv6_ranges: []
multus:
ipv4_ranges:
- end: 172.17.0.70
end_host: 70
length: 41
start: 172.17.0.30
start_host: 30
ipv6_ranges: []
netconfig:
ipv4_ranges:
- end: 172.17.0.250
end_host: 250
length: 151
start: 172.17.0.100
start_host: 100
ipv6_ranges: []
vlan_id: 20
storage:
dns_v4: []
dns_v6: []
mtu: 1496
network_name: storage
network_v4: 172.18.0.0/24
search_domain: storage.example.com
tools:
metallb:
ipv4_ranges:
- end: 172.18.0.90
end_host: 90
length: 11
start: 172.18.0.80
start_host: 80
ipv6_ranges: []
multus:
ipv4_ranges:
- end: 172.18.0.70
end_host: 70
length: 41
start: 172.18.0.30
start_host: 30
ipv6_ranges: []
netconfig:
ipv4_ranges:
- end: 172.18.0.250
end_host: 250
length: 151
start: 172.18.0.100
start_host: 100
ipv6_ranges: []
vlan_id: 21
storagemgmt:
dns_v4: []
dns_v6: []
mtu: 1500
network_name: storagemgmt
network_v4: 172.20.0.0/24
search_domain: storagemgmt.example.com
tools:
netconfig:
ipv4_ranges:
- end: 172.20.0.250
end_host: 250
length: 151
start: 172.20.0.100
start_host: 100
ipv6_ranges: []
vlan_id: 23
tenant:
dns_v4: []
dns_v6: []
mtu: 1496
network_name: tenant
network_v4: 172.19.0.0/24
search_domain: tenant.example.com
tools:
metallb:
ipv4_ranges:
- end: 172.19.0.90
end_host: 90
length: 11
start: 172.19.0.80
start_host: 80
ipv6_ranges: []
multus:
ipv4_ranges:
- end: 172.19.0.70
end_host: 70
length: 41
start: 172.19.0.30
start_host: 30
ipv6_ranges: []
netconfig:
ipv4_ranges:
- end: 172.19.0.250
end_host: 250
length: 151
start: 172.19.0.100
start_host: 100
ipv6_ranges: []
vlan_id: 22
Loading

0 comments on commit d862c8b

Please sign in to comment.