Skip to content

Commit f53d409

Browse files
committed
[ipi] add machine net and vips according to dual or single stack
- OCP >= 4.12 can use either IPv4/IPv6 dual or single stack - anything before will default to IPv4 - use IPv4/IPv6 machineCIDR and VIPs accordingly
1 parent 2090917 commit f53d409

File tree

4 files changed

+50
-41
lines changed

4 files changed

+50
-41
lines changed

roles/installer/templates/install-config-virtualmedia.j2

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,32 @@ proxy:
99
metadata:
1010
name: {{ cluster }}
1111
networking:
12-
{% if not dualstack_baremetal|bool %}
13-
machineCIDR: {{ extcidrnet }}
14-
{% endif %}
1512
networkType: {{ network_type }}
16-
{% if ipv6_enabled|bool and not (ipv4_baremetal|bool or dualstack_baremetal|bool) %}
17-
clusterNetwork:
18-
- cidr: fd01::/48
19-
hostPrefix: 64
20-
serviceNetwork:
21-
- fd02::/112
22-
{% endif %}
23-
{% if ipv6_enabled|bool and dualstack_baremetal|bool %}
13+
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 12)) %}
2414
machineNetwork:
15+
{% if dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool %}
2516
- cidr: {{ extcidrnet }}
17+
{% endif %}
18+
{% if dualstack_baremetal|bool or ipv6_enabled|bool %}
2619
- cidr: {{ extcidrnet6 }}
20+
{% endif %}
21+
{% else %}
22+
machineCIDR: {{ extcidrnet }}
23+
{% endif %}
2724
clusterNetwork:
25+
{% if dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool %}
2826
- cidr: 10.128.0.0/14
2927
hostPrefix: 23
28+
{% endif %}
29+
{% if dualstack_baremetal|bool or ipv6_enabled|bool %}
3030
- cidr: fd02::/48
3131
hostPrefix: 64
32+
{% endif %}
3233
serviceNetwork:
34+
{% if dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool %}
3335
- 172.30.0.0/16
36+
{% endif %}
37+
{% if dualstack_baremetal|bool or ipv6_enabled|bool %}
3438
- fd03::/112
3539
{% endif %}
3640
{% if fips_enabled is defined and fips_enabled|bool %}
@@ -46,24 +50,24 @@ controlPlane:
4650
baremetal: {}
4751
platform:
4852
baremetal:
49-
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 12)) and dualstack_baremetal|bool and dualstack_vips|bool %}
53+
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 12)) %}
5054
apiVIPs:
51-
{% if apivip is defined and apivip|ipv4 %}
55+
{% if (dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool) and apivip is defined and apivip|ipv4 %}
5256
- {{ apivip }}
5357
{% endif %}
54-
{% if ipv6_enabled|bool and apivip6 is defined and apivip6|ipv6 %}
58+
{% if (dualstack_baremetal|bool or ipv6_enabled|bool) and apivip6 is defined and apivip6|ipv6 %}
5559
- {{ apivip6 }}
5660
{% endif %}
5761
ingressVIPs:
58-
{% if ingressvip is defined and ingressvip|ipv4 %}
62+
{% if (dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool) and ingressvip is defined and ingressvip|ipv4 %}
5963
- {{ ingressvip }}
6064
{% endif %}
61-
{% if ipv6_enabled|bool and ingressvip6 is defined and ingressvip6|ipv6 %}
65+
{% if (dualstack_baremetal|bool or ipv6_enabled|bool) and ingressvip6 is defined and ingressvip6|ipv6 %}
6266
- {{ ingressvip6 }}
6367
{% endif %}
6468
{% else %}
65-
apiVIP: {{ apivip }}
66-
ingressVIP: {{ ingressvip }}
69+
apiVIP: {{ (apivip is defined and apivip|ipv4) | ternary(apivip, apivip6) }}
70+
ingressVIP: {{ (ingressvip is defined and ingressvip|ipv4) | ternary(ingressvip, ingressvip6) }}
6771
{% endif %}
6872
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int < 5)) %}
6973
dnsVIP: {{ dnsvip }}

roles/installer/templates/install-config.j2

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,32 @@ proxy:
99
metadata:
1010
name: {{ cluster }}
1111
networking:
12-
{% if not dualstack_baremetal|bool %}
13-
machineCIDR: {{ extcidrnet }}
14-
{% endif %}
1512
networkType: {{ network_type }}
16-
{% if ipv6_enabled|bool and not (ipv4_baremetal|bool or dualstack_baremetal|bool) %}
17-
clusterNetwork:
18-
- cidr: fd01::/48
19-
hostPrefix: 64
20-
serviceNetwork:
21-
- fd02::/112
22-
{% endif %}
23-
{% if ipv6_enabled|bool and dualstack_baremetal|bool %}
13+
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 12)) %}
2414
machineNetwork:
15+
{% if dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool %}
2516
- cidr: {{ extcidrnet }}
17+
{% endif %}
18+
{% if dualstack_baremetal|bool or ipv6_enabled|bool %}
2619
- cidr: {{ extcidrnet6 }}
20+
{% endif %}
21+
{% else %}
22+
machineCIDR: {{ extcidrnet }}
23+
{% endif %}
2724
clusterNetwork:
25+
{% if dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool %}
2826
- cidr: 10.128.0.0/14
2927
hostPrefix: 23
28+
{% endif %}
29+
{% if dualstack_baremetal|bool or ipv6_enabled|bool %}
3030
- cidr: fd02::/48
3131
hostPrefix: 64
32+
{% endif %}
3233
serviceNetwork:
34+
{% if dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool %}
3335
- 172.30.0.0/16
36+
{% endif %}
37+
{% if dualstack_baremetal|bool or ipv6_enabled|bool %}
3438
- fd03::/112
3539
{% endif %}
3640
{% if fips_enabled is defined and fips_enabled|bool %}
@@ -46,24 +50,24 @@ controlPlane:
4650
baremetal: {}
4751
platform:
4852
baremetal:
49-
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 12)) and dualstack_baremetal|bool and dualstack_vips|bool %}
53+
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 12)) %}
5054
apiVIPs:
51-
{% if apivip is defined and apivip|ipv4 %}
55+
{% if (dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool) and apivip is defined and apivip|ipv4 %}
5256
- {{ apivip }}
5357
{% endif %}
54-
{% if ipv6_enabled|bool and apivip6 is defined and apivip6|ipv6 %}
58+
{% if (dualstack_baremetal|bool or ipv6_enabled|bool) and apivip6 is defined and apivip6|ipv6 %}
5559
- {{ apivip6 }}
5660
{% endif %}
5761
ingressVIPs:
58-
{% if ingressvip is defined and ingressvip|ipv4 %}
62+
{% if (dualstack_baremetal|bool or ipv4_baremetal|bool or not ipv6_enabled|bool) and ingressvip is defined and ingressvip|ipv4 %}
5963
- {{ ingressvip }}
6064
{% endif %}
61-
{% if ipv6_enabled|bool and ingressvip6 is defined and ingressvip6|ipv6 %}
65+
{% if (dualstack_baremetal|bool or ipv6_enabled|bool) and ingressvip6 is defined and ingressvip6|ipv6 %}
6266
- {{ ingressvip6 }}
6367
{% endif %}
6468
{% else %}
65-
apiVIP: {{ apivip }}
66-
ingressVIP: {{ ingressvip }}
69+
apiVIP: {{ (apivip is defined and apivip|ipv4) | ternary(apivip, apivip6) }}
70+
ingressVIP: {{ (ingressvip is defined and ingressvip|ipv4) | ternary(ingressvip, ingressvip6) }}
6771
{% endif %}
6872
{% if ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int < 5)) %}
6973
dnsVIP: {{ dnsvip }}

roles/node_prep/defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ https_proxy: ""
1111
ipv4_baremetal: false
1212
ipv4_provisioning: false
1313
dualstack_baremetal: false
14-
dualstack_vips: false
1514
provisioning_bridge: "provisioning"
1615
webserver_url: ""
1716
baremetal_bridge: "baremetal"

roles/node_prep/tasks/10_validation.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,19 @@
125125
- name: Fail if incorrect API VIP
126126
fail:
127127
msg: "The API VIP IP seems to be incorrect. Value was NXDOMAIN or empty string."
128-
when: (apivip == 'NXDOMAIN') or (apivip|length == 0)
128+
when:
129+
- dualstack_baremetal|bool or ipv4_baremetal|bool
130+
- (apivip == 'NXDOMAIN') or (apivip|length == 0)
129131
tags:
130132
- always
131133
- validation
132134

133135
- name: Fail if incorrect Ingress VIP
134136
fail:
135137
msg: "The Ingress VIP IP seems to be incorrect. Value was NXDOMAIN or empty string."
136-
when: (ingressvip == 'NXDOMAIN') or (ingressvip|length == 0)
138+
when:
139+
- dualstack_baremetal|bool or ipv4_baremetal|bool
140+
- (ingressvip == 'NXDOMAIN') or (ingressvip|length == 0)
137141
tags:
138142
- always
139143
- validation
@@ -299,8 +303,6 @@
299303
when:
300304
- release_version is ansible.builtin.version('4.12', '>=')
301305
- ipv6_enabled | bool
302-
- dualstack_baremetal | bool
303-
- dualstack_vips | bool
304306
block:
305307
- name: Verify DNS records for Wildcard (Ingress) IPv6 VIP
306308
ansible.builtin.set_fact:

0 commit comments

Comments
 (0)