Skip to content

Commit 19cb906

Browse files
Enhancements according to best practices
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4fd9898 commit 19cb906

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

collection/stages/roles/day2ops/tasks/procedures/configure_ipv6_secondary.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@
5858
ansible.builtin.set_fact:
5959
ipv6_interfaces: "{{ ipv6_interfaces_results.results | map(attribute='stdout') | list }}"
6060

61+
- name: Validate discovered IPv6 interfaces are not empty
62+
ansible.builtin.assert:
63+
that:
64+
- ipv6_interfaces | length == ipv6_secondary_networks.networks | length
65+
- ipv6_interfaces | select('equalto', '') | list | length == 0
66+
fail_msg: |
67+
Failed to discover IPv6 interfaces on worker {{ ocp_workers[0] }}.
68+
Expected {{ ipv6_secondary_networks.networks | length }} interfaces, got: {{ ipv6_interfaces }}
69+
6170
- name: Display discovered IPv6 interfaces
6271
ansible.builtin.debug:
6372
var: ipv6_interfaces
@@ -174,3 +183,12 @@
174183
loop: "{{ ipv6_secondary_networks.projects }}"
175184
loop_control:
176185
loop_var: ipv6_namespace
186+
187+
- name: Cleanup temporary manifest files
188+
ansible.builtin.file:
189+
path: "{{ item }}"
190+
state: absent
191+
loop: "{{ ['/tmp/network-macvlan.yml'] + ipv6_secondary_networks.projects | map('regex_replace', '^(.*)$', '/tmp/ipv6-deployment-\\1.yml') | list }}"
192+
loop_control:
193+
label: "{{ item }}"
194+
ignore_errors: true # noqa: ignore-errors

collection/stages/roles/day2ops/tasks/procedures/verify_ipv6_connectivity.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,18 @@
3939
ansible.builtin.debug:
4040
var: ipv6_pod_ips
4141

42+
- name: Validate all pods have IPv6 addresses
43+
ansible.builtin.assert:
44+
that:
45+
- ipv6_pod_ips | length > 0
46+
- ipv6_pod_ips.values() | select('equalto', '') | list | length == 0
47+
fail_msg: |
48+
Not all pods in {{ ipv6_namespace }} received IPv6 addresses.
49+
Pod IPs: {{ ipv6_pod_ips }}
50+
4251
- name: Check pod-to-pod IPv6 connectivity in {{ ipv6_namespace }}
4352
ansible.builtin.shell: |
53+
set -o pipefail && \
4454
oc exec {{ item[0] }} -n {{ ipv6_namespace }} -- /bin/curl -s --connect-timeout 10 http://[{{ item[1] }}]:8080
4555
environment:
4656
KUBECONFIG: "{{ kubeconfig }}"

collection/stages/roles/day2ops/tasks/procedures/verify_ipv6_external_reachability.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727

2828
- name: Verify external IPv6 reachability from worker node to pods in {{ ipv6_namespace }}
2929
ansible.builtin.shell: |
30-
oc debug node/{{ ocp_workers[0] }} -- chroot /host curl -s --connect-timeout 10 http://[{{ item.stdout }}]:8080
30+
set -o pipefail && \
31+
timeout 120 oc debug node/{{ ocp_workers[0] }} -- chroot /host curl -s --connect-timeout 10 http://[{{ item.stdout }}]:8080
3132
environment:
3233
KUBECONFIG: "{{ kubeconfig }}"
3334
loop: "{{ ext_pod_ipv6_results.results }}"

0 commit comments

Comments
 (0)