Skip to content

Commit 1c9e88e

Browse files
Merge pull request #41 from shiftstack/osp-verification-lb-ci-stability
osp_verification: stabilize LB tests in periodic CI jobs
2 parents 9f5ac0e + 69626c9 commit 1c9e88e

20 files changed

Lines changed: 309 additions & 26 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
---
22
# defaults file for lb_tests
33
lb_allowlist_file: 'files/openstack-test-lb-allowlist.yaml'
4+
lb_amphora_allowlist_file: "{{ role_path }}/files/openstack-test-lb-amphora-allowlist.yaml"
5+
lb_ovn_allowlist_file: "{{ role_path }}/files/openstack-test-lb-ovn-allowlist.yaml"
6+
lb_blocklist_file: "{{ role_path }}/files/openstack-test-lb-ingress-blocklist.yaml"
7+
lb_amphora_isolated_allowlist_file: "{{ role_path }}/files/openstack-test-lb-amphora-isolated-allowlist.yaml"
8+
lb_amphora_sourceranges_allowlist_file: "{{ role_path }}/files/openstack-test-lb-amphora-sourceranges-allowlist.yaml"
9+
# Two-phase amphora: run isolation-sensitive LB cases first, then the rest.
10+
# sourceRanges runs in a third late Amphora phase (see main.yml).
11+
lb_amphora_two_phase_tests: true
12+
# Broad guest cleanup (e2e projects, shard ICs, ERROR LBs). Off by default on shared labs.
13+
lb_tests_guest_cleanup: false
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
".*Amphora.*":
3+
note: "Amphora Load Balancer tests (lb_tests stage only)"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# Run first on a clean cluster (see lb_tests two-phase amphora flow).
3+
# Order of keys defines serial run order when filter_tests_list applies this allowlist.
4+
# UDP sourceRanges is intentionally NOT here — it runs in a late Amphora phase after
5+
# other Amphora cases so OCCM/Octavia are less contended (allowed_cidrs clear flake).
6+
".*create a UDP Amphora LoadBalancer when a UDP svc with type:LoadBalancer is created on Openshift":
7+
note: "UDP Amphora basic (before other cases allocate shared LBs)"
8+
".*apply lb-method on TCP Amphora LoadBalancer when a TCP svc with monitors and ETP:Local is created on Openshift":
9+
note: "TCP Amphora lb-method + monitors"
10+
".*apply lb-method on UDP Amphora LoadBalancer when a UDP svc with monitors and ETP:Local is created on Openshift":
11+
note: "UDP Amphora lb-method + monitors"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
# Late Amphora-only phase (after isolated + remaining amphora, before OVN).
3+
# sourceRanges clearing allowed_cidrs is sensitive to OCCM load; running it last
4+
# under Amphora config improves odds without a dedicated ansible stage.
5+
".*limit service access on an UDP Amphora LoadBalancer when an UDP LoadBalancer svc setting the loadBalancerSourceRanges spec is created on Openshift":
6+
note: "UDP Amphora loadBalancerSourceRanges (after other Amphora LB tests)"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
".*LoadBalancerService ingressController is created on Openshift.*":
3+
note: "Deferred — OSASINFRA-2412 / IngressController admission (run 7); re-enable when fixed."
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
".*OVN.*":
3+
note: "OVN Load Balancer tests (lb_tests stage only)"
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
# Best-effort guest cleanup between LB test phases (max-shared-lb / Octavia slots).
3+
- name: List e2e-test-openstack projects
4+
ansible.builtin.shell: |
5+
set -o pipefail
6+
oc get projects -o name 2>/dev/null | sed 's|project/||' | grep -E '^e2e-test-openstack-' || true
7+
environment:
8+
KUBECONFIG: "{{ kubeconfig }}"
9+
register: lb_cleanup_e2e_projects_cmd
10+
changed_when: false
11+
failed_when: false
12+
13+
- name: List shard IngressControllers
14+
ansible.builtin.shell: |
15+
set -o pipefail
16+
oc get ingresscontroller -n openshift-ingress-operator -o name 2>/dev/null | grep shard- || true
17+
environment:
18+
KUBECONFIG: "{{ kubeconfig }}"
19+
register: lb_cleanup_shard_ics_cmd
20+
changed_when: false
21+
failed_when: false
22+
23+
- name: Delete stale e2e-test-openstack projects (async)
24+
ansible.builtin.command:
25+
argv:
26+
- oc
27+
- delete
28+
- project
29+
- "{{ item }}"
30+
- --wait=false
31+
environment:
32+
KUBECONFIG: "{{ kubeconfig }}"
33+
loop: "{{ lb_cleanup_e2e_projects_cmd.stdout_lines | default([]) }}"
34+
loop_control:
35+
label: "{{ item }}"
36+
register: lb_cleanup_delete_projects
37+
changed_when: lb_cleanup_delete_projects.rc == 0
38+
failed_when: false
39+
when: lb_cleanup_e2e_projects_cmd.stdout_lines | default([]) | length > 0
40+
41+
- name: Delete shard IngressControllers left by ingress LB tests (async)
42+
ansible.builtin.command:
43+
argv:
44+
- oc
45+
- delete
46+
- "{{ item }}"
47+
- --wait=false
48+
environment:
49+
KUBECONFIG: "{{ kubeconfig }}"
50+
loop: "{{ lb_cleanup_shard_ics_cmd.stdout_lines | default([]) }}"
51+
loop_control:
52+
label: "{{ item }}"
53+
register: lb_cleanup_delete_ics
54+
changed_when: lb_cleanup_delete_ics.rc == 0
55+
failed_when: false
56+
when: lb_cleanup_shard_ics_cmd.stdout_lines | default([]) | length > 0
57+
58+
- name: Delete Octavia load balancers in ERROR state
59+
ansible.builtin.shell: |
60+
set -o pipefail
61+
openstack loadbalancer list -f value -c id -c provisioning_status 2>/dev/null | while read -r id st; do
62+
if [ "$st" = "ERROR" ]; then
63+
openstack loadbalancer delete "$id" --wait 2>/dev/null || true
64+
fi
65+
done
66+
environment:
67+
OS_CLOUD: "{{ user_cloud }}"
68+
changed_when: false
69+
failed_when: false

‎collection/stages/roles/lb_tests/tasks/main.yml‎

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
---
2+
# include_role(openstack_test) re-templates vars; role_path there is openstack_test, not lb_tests.
3+
- name: Best-effort cleanup before LB tests
4+
ansible.builtin.include_tasks: cleanup_lb_test_leftovers.yml
5+
when: lb_tests_guest_cleanup | bool
6+
7+
- name: Materialize LB allow/block paths for nested openstack_test role
8+
ansible.builtin.set_fact:
9+
lb_ingress_blocklist_resolved: "{{ lb_blocklist_file }}"
10+
lb_amphora_allowlist_resolved: "{{ lb_amphora_allowlist_file }}"
11+
lb_amphora_isolated_allowlist_resolved: "{{ lb_amphora_isolated_allowlist_file }}"
12+
lb_amphora_sourceranges_allowlist_resolved: "{{ lb_amphora_sourceranges_allowlist_file }}"
13+
lb_ovn_allowlist_resolved: "{{ lb_ovn_allowlist_file }}"
14+
215
- name: Get install-config content to obtain the 1st machineCIDR
316
ansible.builtin.include_role:
417
name: shiftstack.tools.tools_get_deploy_info
@@ -24,14 +37,50 @@
2437
max_shared_lb: "2"
2538
log_directory: "{{ artifacts_dir }}/lb_amphora_sourceip"
2639

27-
- name: Run Openstack-Test on OCP with Amphora LoadBalancer provider and sourceIP lb method
28-
ansible.builtin.include_role:
29-
name: shiftstack.stages.openstack_test
40+
- name: Amphora LB tests — phase 1 (isolation-sensitive cases on clean slate)
41+
when: lb_amphora_two_phase_tests | bool
42+
block:
43+
- name: Run amphora isolated LB openstack-test phase
44+
ansible.builtin.include_tasks: run_amphora_openstack_test.yml
45+
vars:
46+
lb_amphora_openstack_test_results_dir: "{{ artifacts_dir }}/lb_amphora_sourceip_isolated"
47+
lb_amphora_openstack_test_allowlist: "{{ lb_amphora_isolated_allowlist_resolved }}"
48+
lb_amphora_openstack_test_blocklist: "{{ lb_ingress_blocklist_resolved }}"
49+
lb_amphora_openstack_testsuite_name: openstack_tests_lb_amphora_sourceip_isolated
50+
lb_amphora_openstack_reset_result_dir: true
51+
52+
- name: Cleanup guest LB leftovers between amphora phases
53+
ansible.builtin.include_tasks: cleanup_lb_test_leftovers.yml
54+
when: lb_tests_guest_cleanup | bool
55+
56+
- name: Amphora LB tests — phase 2 (remaining amphora cases)
57+
ansible.builtin.include_tasks: run_amphora_openstack_test.yml
3058
vars:
31-
openstack_test_results_dir: "{{ artifacts_dir }}/lb_amphora_sourceip"
32-
openstack_tests_allowlist_file: "{{ lb_allowlist_file }}"
33-
openstack_testsuite_name: openstack_tests_lb_amphora_sourceip
34-
openstack_reset_result_dir: no # As we want to keep the logs generated in the previous step
59+
lb_amphora_openstack_test_results_dir: "{{ artifacts_dir }}/lb_amphora_sourceip"
60+
lb_amphora_openstack_test_allowlist: "{{ lb_amphora_allowlist_resolved }}"
61+
# Exclude isolated + late sourceRanges so those patterns are not double-run.
62+
lb_amphora_openstack_test_blocklist: >-
63+
{{ lb_ingress_blocklist_resolved ~ ',' ~ lb_amphora_isolated_allowlist_resolved ~ ',' ~ lb_amphora_sourceranges_allowlist_resolved
64+
if (lb_amphora_two_phase_tests | bool)
65+
else lb_ingress_blocklist_resolved }}
66+
lb_amphora_openstack_testsuite_name: openstack_tests_lb_amphora_sourceip
67+
lb_amphora_openstack_reset_result_dir: false
68+
69+
- name: Amphora LB tests — phase 3 (UDP sourceRanges after other Amphora cases)
70+
when: lb_amphora_two_phase_tests | bool
71+
block:
72+
- name: Cleanup guest LB leftovers before late sourceRanges
73+
ansible.builtin.include_tasks: cleanup_lb_test_leftovers.yml
74+
when: lb_tests_guest_cleanup | bool
75+
76+
- name: Run amphora UDP sourceRanges openstack-test phase
77+
ansible.builtin.include_tasks: run_amphora_openstack_test.yml
78+
vars:
79+
lb_amphora_openstack_test_results_dir: "{{ artifacts_dir }}/lb_amphora_sourceip_sourceranges"
80+
lb_amphora_openstack_test_allowlist: "{{ lb_amphora_sourceranges_allowlist_resolved }}"
81+
lb_amphora_openstack_test_blocklist: "{{ lb_ingress_blocklist_resolved }}"
82+
lb_amphora_openstack_testsuite_name: openstack_tests_lb_amphora_sourceip_sourceranges
83+
lb_amphora_openstack_reset_result_dir: true
3584

3685
- name: Enable OVN provider on cloud-provider-config
3786
ansible.builtin.include_tasks: change_cloud_cm.yml
@@ -47,6 +96,8 @@
4796
name: shiftstack.stages.openstack_test
4897
vars:
4998
openstack_test_results_dir: "{{ artifacts_dir }}/lb_ovn"
50-
openstack_tests_allowlist_file: "{{ lb_allowlist_file }}"
99+
openstack_tests_allowlist_file: "{{ lb_ovn_allowlist_resolved }}"
100+
openstack_tests_blocklist_file: "{{ lb_ingress_blocklist_resolved }}"
101+
openstack_test_ote_run_serial: true
51102
openstack_testsuite_name: openstack_tests_lb_ovn
52103
openstack_reset_result_dir: no # As we want to keep the logs generated in the previous step
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
# Shared openstack_test invocation for amphora LB (single or two-phase).
3+
- name: Run Openstack-Test on OCP with Amphora LoadBalancer provider and sourceIP lb method
4+
ansible.builtin.include_role:
5+
name: shiftstack.stages.openstack_test
6+
vars:
7+
openstack_test_results_dir: "{{ lb_amphora_openstack_test_results_dir }}"
8+
openstack_tests_allowlist_file: "{{ lb_amphora_openstack_test_allowlist }}"
9+
openstack_tests_blocklist_file: "{{ lb_amphora_openstack_test_blocklist }}"
10+
openstack_test_ote_run_serial: true
11+
openstack_testsuite_name: "{{ lb_amphora_openstack_testsuite_name }}"
12+
openstack_reset_result_dir: "{{ lb_amphora_openstack_reset_result_dir | default(false) }}"

‎collection/stages/roles/openstack_test/defaults/main.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ openstack_test_dir: "{{ artifacts_dir }}/{{ openstack_test_name }}"
77
openstack_test_executable: "{{ home_dir }}/openstack-tests"
88
openstack_test_results_dir: "{{ artifacts_dir }}/{{ openstack_test_name }}-results"
99
openstack_tests_allowlist_file: ""
10-
openstack_tests_blocklist_file: ""
10+
openstack_tests_blocklist_file: "{{ role_path }}/files/openstack-test-lb-blocklist.yaml"
1111
openstack_tests_go_version: "{{ tests.default_go_version_target }}"
1212
# OTE (OpenShift Tests Extension) — used when discovered_openshift_release >= 4.20
1313
openstack_test_suite: openstack-test/all
1414
openstack_test_ote_binary_relpath: bin/openstack-test-tests-ext
15+
# Run filtered OTE tests one-by-one (required for [lb][Serial] under Octavia limits).
16+
openstack_test_ote_run_serial: false

0 commit comments

Comments
 (0)