Skip to content

Commit b22d878

Browse files
committed
Add EgressIP test role for shiftstack-qa
Port EgressIP testing from Jenkins/infrared to shiftstack-qa. - Creates egressip_tests role that runs openshift-tests-private suite - Dynamically detects OCP version (4.12-4.22) and network backend (OpenShiftSDN/OVNKubernetes/Kuryr) - Filters tests using per-version, per-backend allowlist - Integrated into osp_verification.yaml for OSP candidate release validation Allowlist ported from rhos-infrared egressip-whitelist.yaml covering: - 4.12-4.14: OpenShiftSDN, OVNKubernetes, Kuryr support - 4.15+: OVNKubernetes only (SDN deprecated) Change-Id: I222491ea7ed254e12ea5935564c1ce026d9bc105 Signed-off-by: Daniel Lawton <dlawton@redhat.com>
1 parent 7641d9a commit b22d878

8 files changed

Lines changed: 308 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# defaults file for egressip_tests
3+
egressip_test_name: "openshift-tests-private"
4+
egressip_test_dir: "{{ artifacts_dir }}/{{ egressip_test_name }}"
5+
egressip_test_executable: "{{ egressip_test_dir }}/bin/extended-platform-tests"
6+
egressip_test_results_dir: "{{ artifacts_dir }}/egressip_tests"
7+
egressip_allowlist_file: "{{ role_path }}/files/egressip-allowlist.yaml"
8+
egressip_tests_go_version: "{{ tests.default_go_version_target }}"
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
all_allow_list: &all_allow_list
3+
{}
4+
5+
sdn_list: &sdn_tests
6+
<<: *all_allow_list
7+
".*Author:jechen-High-46555-Medium-46962-[Automatic EgressIP] Random egressIP is used on a pod that is not on a node hosting an egressIP, and random outages with egressIP . [.*":
8+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
9+
".*Author:jechen-High-46556-[Automatic EgressIP] A pod that is on a node hosting egressIP, it will always use the egressIP of the node . [.*":
10+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
11+
".*Author:jechen-High-46557-[Manual EgressIP] Random egressIP is used on a pod that is not on a node hosting an egressIP . [.*":
12+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
13+
".*Author:jechen-High-46558-[Manual EgressIP] A pod that is on a node hosting egressIP, it will always use the egressIP of the node . [.*":
14+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
15+
".*Author:jechen-High-47462-EgressNetworkPolicy should work well with egressIP [.*":
16+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
17+
".*Author:jechen-Medium-47461-Should not be able to access the node via the egressIP [.*":
18+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
19+
".*Author:jechen-High-46559-[Automatic EgressIP] If some egress node is unavailable, pods continue use other available egressIPs after a short delay. [.*":
20+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
21+
".*Author:jechen-High-46561-[Manual EgressIP] If some egress node is unavailable, pods continue use other available egressIPs after a short delay. [.*":
22+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
23+
".*Author:jechen-High-46701-High-47470-Pods will lose external access if same egressIP is assigned to different netnamespace, error should be logged on master node. [.*":
24+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
25+
".*Author:jechen-High-46705-The egressIP should still work fine after the node or network service restarted. [.*":
26+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
27+
".*Author:jechen-High-46960- EgressIP can failover if the node is NotReady. [.*":
28+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
29+
".*Author:jechen-High-47455-The egressIP could be assigned to project automatically once it is defined in hostsubnet egressCIDR. [.*":
30+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
31+
".*Author:jechen-High-47464-The egressIP will be unavailable if it is set to multiple hostsubnets. [.*":
32+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
33+
".*Author:jechen-High-47468-High-47469-Pod access external through egressIP if egress node hosts the egressIP that assigned to netns, or it lose access to external if no node hosts the egressIP that assigned to netns. [.*":
34+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
35+
".*Author:jechen-High-47054-The egressIP can be HA if netnamespace has single egressIP . [.*":
36+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
37+
".*Author:jechen-High-47456-High-47457-Can change egressIP of project when there are multiple egressIP, can access outside with nodeIP after egressIP is removed. [.*":
38+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
39+
".*Author:jechen-High-47458-High-47459-EgressIP works when reusing the egressIP that was held by a deleted project, EgressIP works well after removed egressIP is added back. [.*":
40+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
41+
".*Author:jechen-High-47463-Pod will not be affected by the egressIP set on other netnamespace. [.*":
42+
description: "https://issues.redhat.com/browse/KURYRQE-1007"
43+
44+
ovnk_list: &ovnk_tests
45+
<<: *all_allow_list
46+
".*Author:huirwang.*47019.*EgressIP works well with networkpolicy and egressFirewall.*":
47+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
48+
".*Author:huirwang.*47018.*47017.*Multiple projects use same EgressIP.*":
49+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
50+
".*Author:huirwang.*47028.*After remove EgressIP node tag.*failover.*":
51+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
52+
".*Author:huirwang.*47030.*EgressIP object can not have multiple egress IP assignments on the same node.*":
53+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
54+
".*Author:huirwang.*47031.*After reboot egress node EgressIP still work.*":
55+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
56+
".*Author:huirwang.*47032.*47034.*Traffic is load balanced between egress nodes.*":
57+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
58+
".*Author:huirwang.*47164.*47025.*update egressip object.*pods removed matched labels.*":
59+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
60+
".*Author:huirwang.*47272.*Pods will not be affected by the egressIP set on other netnamespace.*":
61+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
62+
".*Author:huirwang.*55632.*egress node shouldn't generate broadcast ARP for service IPs.*":
63+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
64+
".*Author:huirwang.*47029.*47024.*egress IP can only be assigned to one node only.*Warning event.*":
65+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
66+
".*Author:huirwang.*47163.*47026.*Deleting EgressIP object and recreating it works.*":
67+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
68+
".*Author:huirwang.*47021.*lr-policy-list and snat should be updated correctly after remove pods.*":
69+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
70+
".*Author:huirwang.*55030.*After reboot egress node.*lr-policy-list and snat should keep correct.*":
71+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
72+
".*Author:huirwang.*53069.*EgressIP should work for recreated same name pod.*":
73+
description: "https://issues.redhat.com/browse/KURYRQE-1016"
74+
75+
##########
76+
# This feature is supported since OpenShift 4.12
77+
78+
# OpenShift 4.12
79+
"4.12":
80+
"OpenShiftSDN":
81+
<<: *sdn_tests
82+
83+
"OVNKubernetes":
84+
<<: *ovnk_tests
85+
86+
"Kuryr":
87+
<<: *all_allow_list
88+
89+
# OpenShift 4.13
90+
"4.13":
91+
"OpenShiftSDN":
92+
<<: *sdn_tests
93+
94+
"OVNKubernetes":
95+
<<: *ovnk_tests
96+
97+
"Kuryr":
98+
<<: *all_allow_list
99+
100+
# OpenShift 4.14
101+
"4.14":
102+
"OpenShiftSDN":
103+
<<: *sdn_tests
104+
105+
"OVNKubernetes":
106+
<<: *ovnk_tests
107+
108+
"Kuryr":
109+
<<: *all_allow_list
110+
111+
# OpenShift 4.15
112+
"4.15":
113+
"OVNKubernetes":
114+
<<: *ovnk_tests
115+
116+
# OpenShift 4.16
117+
"4.16":
118+
"OVNKubernetes":
119+
<<: *ovnk_tests
120+
121+
# OpenShift 4.17
122+
"4.17":
123+
"OVNKubernetes":
124+
<<: *ovnk_tests
125+
126+
# OpenShift 4.18
127+
"4.18":
128+
"OVNKubernetes":
129+
<<: *ovnk_tests
130+
131+
# OpenShift 4.19
132+
"4.19":
133+
"OVNKubernetes":
134+
<<: *ovnk_tests
135+
136+
# OpenShift 4.20
137+
"4.20":
138+
"OVNKubernetes":
139+
<<: *ovnk_tests
140+
141+
# OpenShift 4.21
142+
"4.21":
143+
"OVNKubernetes":
144+
<<: *ovnk_tests
145+
146+
# OpenShift 4.22
147+
"4.22":
148+
"OVNKubernetes":
149+
<<: *ovnk_tests
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
collections:
3+
- shiftstack.tools
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# tasks file for egressip_tests
3+
- name: Prepare EgressIP test
4+
ansible.builtin.include_role:
5+
name: tools_openshift_tests
6+
tasks_from: prepare_openshift_tests.yml
7+
vars:
8+
repo_name: "{{ egressip_test_name }}"
9+
results_dir: "{{ egressip_test_results_dir }}"
10+
go_version_target: "{{ egressip_tests_go_version }}"
11+
reset_result_dir: "{{ egressip_reset_result_dir | default(True) }}"
12+
13+
- name: Run egressip tests
14+
ansible.builtin.include_tasks: run_egressip_tests.yml
15+
16+
- name: Post EgressIP test
17+
ansible.builtin.include_role:
18+
name: tools_openshift_tests
19+
tasks_from: post_openshift_tests.yml
20+
vars:
21+
testsuite_name: "egressip_tests"
22+
key_for_filtering_results: "egressip"
23+
test_name: "{{ egressip_test_name }}"
24+
results_dir: "{{ egressip_test_results_dir }}"
25+
26+
- name: Remove the source directory after tests complete
27+
ansible.builtin.file:
28+
path: "{{ egressip_test_dir }}"
29+
state: absent
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
- name: Load the full allowlist file
3+
ansible.builtin.set_fact:
4+
egressip_full_allowlist: "{{ lookup('file', egressip_allowlist_file) | from_yaml }}"
5+
6+
- name: Detect network backend
7+
ansible.builtin.shell: |
8+
oc get network.config cluster -o jsonpath='{.status.networkType}'
9+
environment:
10+
KUBECONFIG: "{{ kubeconfig }}"
11+
register: network_backend_result
12+
changed_when: false
13+
14+
- name: Set network backend fact
15+
ansible.builtin.set_fact:
16+
network_backend: "{{ network_backend_result.stdout }}"
17+
18+
- name: Extract allowlist for current version and network backend
19+
ansible.builtin.set_fact:
20+
egressip_version_allowlist: "{{ egressip_full_allowlist[discovered_openshift_release][network_backend] | default({}) }}"
21+
22+
- name: Fail if no allowlist found for this version/backend combination
23+
ansible.builtin.fail:
24+
msg: "No allowlist found for OCP {{ discovered_openshift_release }} with {{ network_backend }}"
25+
when: egressip_version_allowlist | length == 0
26+
27+
- name: Write filtered allowlist to temporary file
28+
ansible.builtin.copy:
29+
content: "{{ egressip_version_allowlist | to_nice_yaml }}"
30+
dest: "{{ egressip_test_results_dir }}/allowlist.yaml"
31+
mode: '0644'
32+
33+
- name: Set artifact paths
34+
ansible.builtin.set_fact:
35+
all_tests_path: "{{ egressip_test_results_dir }}/egressip_tests.txt"
36+
allowlist_path: "{{ egressip_test_results_dir }}/allowlist.txt"
37+
tests_to_run_path: "{{ egressip_test_results_dir }}/list_of_tests_to_run.txt"
38+
39+
- name: Build extended-platform-tests executable
40+
ansible.builtin.shell: |
41+
source {{ home_dir }}/.bashrc
42+
make WHAT=cmd/openshift-tests
43+
args:
44+
chdir: "{{ egressip_test_dir }}"
45+
changed_when: true
46+
47+
- name: Get full list of tests
48+
ansible.builtin.shell: >
49+
{{ egressip_test_executable }} run all --dry-run > {{ all_tests_path }}
50+
environment:
51+
KUBECONFIG: "{{ kubeconfig }}"
52+
OS_CLOUD: "{{ user_cloud }}"
53+
changed_when: true
54+
55+
- name: Convert the allowlist YAML to TXT
56+
ansible.builtin.include_role:
57+
name: tools_openshift_tests
58+
tasks_from: convert_yaml_tests_file_to_txt.yml
59+
vars:
60+
input_tests_list: "{{ egressip_test_results_dir }}/allowlist.yaml"
61+
output_tests_list: "{{ allowlist_path }}"
62+
yaml_format_based_on_ocp_version: true
63+
64+
- name: Prepare the tests list to run
65+
shiftstack.tools.filter_tests_list:
66+
input_tests_file: "{{ all_tests_path }}"
67+
allowlist_file: "{{ allowlist_path }}"
68+
blocklist_file: ""
69+
output_file: "{{ tests_to_run_path }}"
70+
71+
- name: Run the egressip tests
72+
block:
73+
- name: Run egressIP tests
74+
ansible.builtin.shell: >
75+
{{ egressip_test_executable }} run
76+
-f {{ tests_to_run_path }}
77+
--output-file {{ egressip_test_results_dir }}/{{ egressip_test_name }}.log
78+
--junit-dir={{ egressip_test_results_dir }} > /dev/null
79+
environment:
80+
KUBECONFIG: "{{ kubeconfig }}"
81+
OS_CLOUD: "{{ user_cloud }}"
82+
changed_when: true
83+
84+
rescue:
85+
- name: Mark the egressip tests as UNSTABLE
86+
ansible.builtin.include_role:
87+
name: tools_stage_results
88+
tasks_from: mark_stage_unstable.yml
89+
vars:
90+
unstable_msg: >-
91+
The EgressIP test suite failed.
92+
93+
- name: Run must-gather
94+
ansible.builtin.include_role:
95+
name: tools_must-gather
96+
vars:
97+
must_gather_suffix: "egressip-tests"

jobs_definitions/osp_verification.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ stages:
2121
- verification
2222
- openstack_test
2323
- lb_tests
24+
- egressip_tests
2425

2526
ocp_deployment_topology:
2627
network_type: OVNKubernetes

playbooks/ocp_testing.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,7 @@
103103
- name: Run Openshift Manila CSI Tests on OpenShift
104104
ansible.builtin.import_playbook: plays/manila_csi.yaml
105105
when: "'manila_csi_tests' in stages"
106+
107+
- name: Run EgressIP tests on OpenShift
108+
ansible.builtin.import_playbook: plays/egressip_tests.yaml
109+
when: "'egressip_tests' in stages"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: Run EgressIP tests on OpenShift
3+
hosts: installer
4+
gather_facts: no
5+
vars_files:
6+
- "../../configs/global.yml"
7+
tasks:
8+
- name: Main block
9+
block:
10+
- name: Run EgressIP tests on OpenShift
11+
ansible.builtin.include_role:
12+
name: shiftstack.stages.egressip_tests
13+
always:
14+
- name: Synchronize artifacts from the Ansible Managed Node to Ansible Controller
15+
ansible.builtin.include_role:
16+
name: shiftstack.tools.tools_ansible_inventory
17+
tasks_from: sync_artifacts.yml

0 commit comments

Comments
 (0)