Skip to content

Commit b2ea604

Browse files
committed
[ci_gen_kustomize_values] Use ctlplane_ocp_nad ranges for LB and NAD
Avoid IP conflicts when dnsmasq pods try to reach dnsmasq service running on the hypervisor by using a new NAD and LB range, ctlplane_ocp_nad OSPRH-23100 Signed-off-by: Eduardo Olivares <[email protected]>
1 parent 057f5ea commit b2ea604

File tree

3 files changed

+53
-35
lines changed

3 files changed

+53
-35
lines changed

roles/ci_gen_kustomize_values/templates/bgp-l3-xl/network-values/values.yaml.j2

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ data:
2020
},
2121
recursive=true) %}
2222
{{ network.network_name }}_ip: {{ network.ip_v4 }}
23-
{% if 'worker-9' == hostname and 'ctlplane' == network.network_name %}
23+
{% if 'ctlplane' == network.network_name %}
2424
base_if: {{ network.interface_name }}
2525
{% endif %}
2626
{% endfor %}
@@ -50,6 +50,7 @@ data:
5050
{% endfor %}
5151

5252
{% for network in cifmw_networking_env_definition.networks.values() %}
53+
{% if network.network_name != 'ctlplane_ocp_nad' %}
5354
{% set ns.lb_tools = {} %}
5455
{{ network.network_name }}:
5556
dnsDomain: {{ network.search_domain }}
@@ -95,7 +96,8 @@ data:
9596
{% if ns.lb_tools | length > 0 %}
9697
lb_addresses:
9798
{% for tool in ns.lb_tools.keys() %}
98-
{% for lb_range in network.tools[tool].ipv4_ranges %}
99+
{% set lb_range_network = network if network.network_name != "ctlplane" else cifmw_networking_env_definition.networks.ctlplane_ocp_nad %}
100+
{% for lb_range in lb_range_network.tools[tool].ipv4_ranges %}
99101
- {{ lb_range.start }}-{{ lb_range.end }}
100102
{% set _ = ns.lb_tools[tool].append(lb_range.start) %}
101103
{% endfor %}
@@ -114,10 +116,10 @@ data:
114116
iface: {{ network.network_name }}
115117
base_iface: {{ ns.interfaces[network.network_name] }}
116118
{% endif %}
117-
{% else %}
118-
{% if ns.interfaces[network.network_name] is defined %}
119+
{% elif network.network_name == "ctlplane" %}
119120
iface: {{ ns.interfaces[network.network_name] }}
120-
{% endif %}
121+
{% elif ns.interfaces[network.network_name] is defined %}
122+
iface: {{ network.network_name }}
121123
{% endif %}
122124
{% if network.tools.multus is defined %}
123125
net-attach-def: |
@@ -139,42 +141,36 @@ data:
139141
{% endif %}
140142
"ipam": {
141143
"type": "whereabouts",
142-
"range": "{{ network.network_v4 }}",
143144
{% if network.network_name == "octavia" and network.tools.multus.ipv4_routes | default([]) | length > 0 %}
144145
"routes": [
145-
{% for route in network.tools.multus.ipv4_routes %}
146+
{% for route in network.tools.multus.ipv4_routes %}
146147
{
147148
"dst": "{{ route.destination }}",
148149
"gw": "{{ route.gateway }}"
149150
}{% if not loop.last %},{% endif %}
150-
{% endfor %}
151+
{% endfor %}
151152
],
152153
{% endif %}
153-
"range_start": "{{ network.tools.multus.ipv4_ranges.0.start }}",
154-
"range_end": "{{ network.tools.multus.ipv4_ranges.0.end }}",
155-
{% if network.network_name == "ctlplane" %}
156-
"gateway": "{{ network.network_v4 |ansible.utils.nthhost(2) }}"
157-
{% else %}
158-
"gateway": "{{ network.network_v4 |ansible.utils.nthhost(1) }}"
159-
{% endif %}
154+
{% set range_network = network if network.network_name != "ctlplane" else cifmw_networking_env_definition.networks.ctlplane_ocp_nad %}
155+
"range": "{{ range_network.network_v4 }}",
156+
"range_start": "{{ range_network.tools.multus.ipv4_ranges.0.start }}",
157+
"range_end": "{{ range_network.tools.multus.ipv4_ranges.0.end }}",
158+
"gateway": "{{ range_network.network_v4 |ansible.utils.nthhost(1) }}"
160159
}
161160
}
162161
{% endif %}
162+
{% endif %}
163163
{% endfor %}
164164

165165
dns-resolver:
166166
config:
167167
server:
168-
# We set ctlplane = 192.168.125.0/24 and we rely on this definition to create the nad above.
169-
# BGP exposes nad ips by advertising a 192.168.125.X address on the worker, and this would break dns
170-
# because the traffic will not be sent to the right nic if a local ip on the same network is present.
171-
# To avoid messing with routes etc we hardcode the 122.1 ip here
172-
- 192.168.122.1
168+
- "{{ cifmw_networking_env_definition.networks.ctlplane.gw_v4 }}"
173169
search: []
174170
options:
175171
- key: server
176172
values:
177-
- 192.168.122.1
173+
- {{ cifmw_networking_env_definition.networks.ctlplane.gw_v4 }}
178174
{% for nameserver in cifmw_ci_gen_kustomize_values_nameservers %}
179175
- key: server
180176
values:

roles/ci_gen_kustomize_values/templates/bgp_dt01/network-values/values.yaml.j2

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ data:
2020
},
2121
recursive=true) %}
2222
{{ network.network_name }}_ip: {{ network.ip_v4 }}
23-
{% if 'worker-3' == hostname and 'ctlplane' == network.network_name %}
23+
{% if 'ctlplane' == network.network_name %}
2424
base_if: {{ network.interface_name }}
2525
{% endif %}
2626
{% endfor %}
@@ -56,6 +56,7 @@ data:
5656
{% endfor %}
5757

5858
{% for network in cifmw_networking_env_definition.networks.values() %}
59+
{% if network.network_name != 'ctlplane_ocp_nad' %}
5960
{% set ns.lb_tools = {} %}
6061
{{ network.network_name }}:
6162
dnsDomain: {{ network.search_domain }}
@@ -101,7 +102,8 @@ data:
101102
{% if ns.lb_tools | length > 0 %}
102103
lb_addresses:
103104
{% for tool in ns.lb_tools.keys() %}
104-
{% for lb_range in network.tools[tool].ipv4_ranges %}
105+
{% set lb_range_network = network if network.network_name != "ctlplane" else cifmw_networking_env_definition.networks.ctlplane_ocp_nad %}
106+
{% for lb_range in lb_range_network.tools[tool].ipv4_ranges %}
105107
- {{ lb_range.start }}-{{ lb_range.end }}
106108
{% set _ = ns.lb_tools[tool].append(lb_range.start) %}
107109
{% endfor %}
@@ -120,10 +122,10 @@ data:
120122
iface: {{ network.network_name }}
121123
base_iface: {{ ns.interfaces[network.network_name] }}
122124
{% endif %}
123-
{% else %}
124-
{% if ns.interfaces[network.network_name] is defined %}
125+
{% elif network.network_name == "ctlplane" %}
126+
iface: {{ ns.interfaces[network.network_name] }}
127+
{% elif ns.interfaces[network.network_name] is defined %}
125128
iface: {{ network.network_name }}
126-
{% endif %}
127129
{% endif %}
128130
{% if network.tools.multus is defined %}
129131
net-attach-def: |
@@ -147,23 +149,25 @@ data:
147149
{% endif %}
148150
"ipam": {
149151
"type": "whereabouts",
150-
"range": "{{ network.network_v4 }}",
151152
{% if network.network_name == "octavia" and network.tools.multus.ipv4_routes | default([]) | length > 0 %}
152153
"routes": [
153-
{% for route in network.tools.multus.ipv4_routes %}
154+
{% for route in network.tools.multus.ipv4_routes %}
154155
{
155156
"dst": "{{ route.destination }}",
156157
"gw": "{{ route.gateway }}"
157158
}{% if not loop.last %},{% endif %}
158-
{% endfor %}
159+
{% endfor %}
159160
],
160161
{% endif %}
161-
"range_start": "{{ network.tools.multus.ipv4_ranges.0.start }}",
162-
"range_end": "{{ network.tools.multus.ipv4_ranges.0.end }}",
163-
"gateway": "{{ network.network_v4 |ansible.utils.nthhost(1) }}"
162+
{% set range_network = network if network.network_name != "ctlplane" else cifmw_networking_env_definition.networks.ctlplane_ocp_nad %}
163+
"range": "{{ range_network.network_v4 }}",
164+
"range_start": "{{ range_network.tools.multus.ipv4_ranges.0.start }}",
165+
"range_end": "{{ range_network.tools.multus.ipv4_ranges.0.end }}",
166+
"gateway": "{{ range_network.network_v4 |ansible.utils.nthhost(1) }}"
164167
}
165168
}
166169
{% endif %}
170+
{% endif %}
167171
{% endfor %}
168172

169173
dns-resolver:

scenarios/reproducers/bgp-l3-xl.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ cifmw_networking_definition:
830830
network: "192.168.125.0/24"
831831
gateway: "192.168.125.1"
832832
dns:
833-
- "192.168.122.1"
833+
- "192.168.125.1"
834834
mtu: 1500
835835
tools:
836836
multus:
@@ -848,6 +848,22 @@ cifmw_networking_definition:
848848
- start: 150
849849
end: 200
850850

851+
ctlplane_ocp_nad:
852+
network: "192.168.126.0/24"
853+
gateway: "192.168.126.1"
854+
dns:
855+
- "192.168.126.1"
856+
mtu: 1500
857+
tools:
858+
multus:
859+
ranges:
860+
- start: 30
861+
end: 70
862+
metallb:
863+
ranges:
864+
- start: 80
865+
end: 90
866+
851867
ctlplaner0:
852868
network: "192.168.122.0/24"
853869
gateway: "192.168.122.1"
@@ -1077,13 +1093,15 @@ cifmw_networking_definition:
10771093
range:
10781094
start: 10
10791095
length: 10
1080-
networks: {}
1096+
networks:
1097+
ctlplane: {}
10811098
ocp_workers:
10821099
network-template:
10831100
range:
10841101
start: 20
10851102
length: 10
1086-
networks: {}
1103+
networks:
1104+
ctlplane: {}
10871105

10881106
instances:
10891107
controller-0:

0 commit comments

Comments
 (0)