Skip to content

Commit b809c67

Browse files
Address PR review comments from imatza-rh
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 19cb906 commit b809c67

5 files changed

Lines changed: 45 additions & 20 deletions

File tree

collection/stages/roles/cleanup/tasks/cleanup_ipv6_secondary.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
ignore_errors: true # noqa: ignore-errors
2929

3030
- name: Delete IPv6 secondary networks
31-
openstack.cloud.network:
32-
cloud: "{{ user_cloud }}"
33-
state: absent
34-
name: "{{ item.net_name }}"
35-
loop: "{{ ipv6_secondary_networks.networks }}"
31+
ansible.builtin.shell: >
32+
openstack network delete {{ item }}
33+
loop: "{{ registered_resources.ipv6_secondary_network_ids | default([]) }}"
34+
environment:
35+
OS_CLOUD: "{{ user_cloud }}"
36+
changed_when: true
3637
ignore_errors: true # noqa: ignore-errors

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,46 @@
3737
ocp_workers: "{{ workers | json_query('resources[*].metadata.name') | sort }}"
3838
num_workers: "{{ workers.resources | length }}"
3939

40-
- name: Discover IPv6 interfaces on first worker
40+
- name: Discover IPv6 interfaces on all workers via live state
4141
ansible.builtin.shell: |
4242
set -o pipefail && \
43-
oc adm node-logs {{ ocp_workers[0] }} | \
44-
grep '{{ item.cidr | regex_replace('::/64$', '') }}' | \
45-
grep dev | \
46-
sed 's/.*{{ item.cidr | regex_replace('::/64$', '') }}::.* dev \(\S\+\).*/\1/g' | \
47-
tail -1
43+
timeout 120 oc debug node/{{ item.0 }} -- chroot /host \
44+
ip -6 addr show scope global | \
45+
grep -B1 '{{ item.1.cidr | regex_replace('::/64$', '') }}' | \
46+
awk -F': ' '/^[0-9]/{print $2}' | head -1
4847
environment:
4948
KUBECONFIG: "{{ kubeconfig }}"
50-
loop: "{{ ipv6_secondary_networks.networks }}"
51-
register: ipv6_interfaces_results
49+
with_nested:
50+
- "{{ ocp_workers }}"
51+
- "{{ ipv6_secondary_networks.networks }}"
52+
register: all_worker_interfaces
5253
changed_when: false
5354
retries: 10
5455
delay: 30
55-
until: ipv6_interfaces_results.stdout != ""
56+
until: all_worker_interfaces.stdout != ""
5657

57-
- name: Store IPv6 interface names
58+
- name: Validate consistent NIC naming across all workers
59+
ansible.builtin.assert:
60+
that:
61+
- per_network_interfaces | unique | length == 1
62+
fail_msg: |
63+
NIC naming inconsistency for {{ item.net_name }}: {{ per_network_interfaces }}
64+
Workers have different interface names for the same IPv6 network.
65+
vars:
66+
per_network_interfaces: "{{ all_worker_interfaces.results | selectattr('item.1.net_name', 'equalto', item.net_name) | map(attribute='stdout') | list }}"
67+
loop: "{{ ipv6_secondary_networks.networks }}"
68+
69+
- name: Store IPv6 interface names (validated consistent across workers)
5870
ansible.builtin.set_fact:
59-
ipv6_interfaces: "{{ ipv6_interfaces_results.results | map(attribute='stdout') | list }}"
71+
ipv6_interfaces: "{{ all_worker_interfaces.results | selectattr('item.0', 'equalto', ocp_workers[0]) | map(attribute='stdout') | list }}"
6072

6173
- name: Validate discovered IPv6 interfaces are not empty
6274
ansible.builtin.assert:
6375
that:
6476
- ipv6_interfaces | length == ipv6_secondary_networks.networks | length
6577
- ipv6_interfaces | select('equalto', '') | list | length == 0
6678
fail_msg: |
67-
Failed to discover IPv6 interfaces on worker {{ ocp_workers[0] }}.
79+
Failed to discover IPv6 interfaces on workers.
6880
Expected {{ ipv6_secondary_networks.networks | length }} interfaces, got: {{ ipv6_interfaces }}
6981
7082
- name: Display discovered IPv6 interfaces
@@ -94,18 +106,20 @@
94106
KUBECONFIG: "{{ kubeconfig }}"
95107
changed_when: true
96108

97-
- name: Verify NetworkAttachmentDefinition CRs exist
109+
- name: Verify NetworkAttachmentDefinition CR exists in {{ item }}
98110
kubernetes.core.k8s_info:
99111
kubeconfig: "{{ kubeconfig }}"
100112
api_version: k8s.cni.cncf.io/v1
101113
kind: NetworkAttachmentDefinition
114+
namespace: "{{ item }}"
102115
register: network_attachments
103116
until:
104117
- network_attachments is defined
105118
- network_attachments is not failed
106-
- network_attachments | json_query('resources[*].metadata.name') | list | sort == ipv6_secondary_networks.projects | sort
119+
- network_attachments.resources | length > 0
107120
retries: 10
108121
delay: 30
122+
loop: "{{ ipv6_secondary_networks.projects }}"
109123

110124
- name: Template IPv6 test deployments
111125
ansible.builtin.template:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
- name: Reset pod IP mapping for {{ ipv6_namespace }}
3+
ansible.builtin.set_fact:
4+
ipv6_pod_ips: {}
5+
26
- name: Get pods in namespace {{ ipv6_namespace }}
37
kubernetes.core.k8s_info:
48
kubeconfig: "{{ kubeconfig }}"

collection/stages/roles/install/tasks/install_config_generation/ipi_install_config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
changed_when: false
2323
register: _cacert_content
2424

25+
- name: Load registered resources for IPv6 secondary network IDs
26+
ansible.builtin.include_vars:
27+
file: "{{ resources_file }}"
28+
name: registered_resources
29+
when: ocp_deployment_topology.secondary_ip_protocol == 'ipv6'
30+
2531
- name: Generate install-config.yaml from install-config-ipi.yaml.j2 template
2632
ansible.builtin.template:
2733
src: install-config-ipi.yaml.j2

collection/stages/roles/install/templates/install-config-ipi.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ compute:
1818
type: "{{ installcfg_worker_flavor }}"
1919
serverGroupPolicy: "{{ installcfg_worker_servergrouppolicy }}"
2020
{%- if ocp_deployment_topology.secondary_ip_protocol == 'ipv6' +%}
21-
additionalNetworkIDs: {{ ipv6_secondary_network_ids | to_json }}
21+
additionalNetworkIDs: {{ registered_resources.ipv6_secondary_network_ids | to_json }}
2222
{%- endif +%}
2323
replicas: {{ installcfg_worker_replicas }}
2424
metadata:

0 commit comments

Comments
 (0)