Skip to content

Commit 7f706b7

Browse files
Merge pull request #4865 from openshift-cherrypick-robot/cherry-pick-4844-to-release-4.18
[release-4.18] OCPBUGS-51015: Enforce VIPs to be collocated at the same host
2 parents d3aff45 + 5ec802a commit 7f706b7

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

Diff for: templates/master/00-master/on-prem/files/keepalived-keepalived.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,63 @@ contents:
6969
fall 2
7070
}
7171
72+
{{- if and (eq .Infra.Status.PlatformStatus.Type "OpenStack") (or (eq .IPFamilies "DualStack") (eq .IPFamilies "DualStackIPv6Primary")) }}
73+
# When using dual-stack with OpenStack, both IPv4 and IPv6 share the same Neutron Port,
74+
# causing OVN to assume both addresses belong to the same node, which may not always be the case.
75+
# To address this, we ensure that the API VIPs remain grouped through state changes,
76+
# the same goes for Ingress VIPs.
77+
vrrp_sync_group VG_API {
78+
group {
79+
{{`{{ range $i, $config := .Configs }}`}}
80+
{{`{{$nonVirtualIP := .NonVirtualIP}}`}}
81+
82+
{{`{{$participateInAPIVRRP := not .EnableUnicast}}`}}
83+
{{`{{- if .EnableUnicast}}
84+
{{- range .LBConfig.Backends}}
85+
{{- if eq $nonVirtualIP .Address}}
86+
{{$participateInAPIVRRP = true}}
87+
{{- end}}
88+
{{- end}}
89+
{{- end}}`}}
90+
91+
{{`{{if $participateInAPIVRRP}}`}}
92+
{{`{{ .Cluster.Name }}`}}_API_{{`{{$i}}`}}
93+
{{`{{ end }}`}}
94+
{{`{{ end }}`}}
95+
}
96+
track_script {
97+
chk_ocp_lb
98+
chk_ocp_both
99+
chk_mcs
100+
}
101+
}
102+
103+
vrrp_sync_group VG_INGRESS {
104+
group {
105+
{{`{{ range $i, $config := .Configs }}`}}
106+
{{`{{$nonVirtualIP := .NonVirtualIP}}`}}
107+
{{`{{$participateInIngressVRRP := not .EnableUnicast}}`}}
108+
{{`{{- if .EnableUnicast}}
109+
{{- range .IngressConfig.Peers}}
110+
{{- if eq $nonVirtualIP .}}
111+
{{$participateInIngressVRRP = true}}
112+
{{- end}}
113+
{{- end}}
114+
{{- end}}`}}
115+
116+
{{`{{if $participateInIngressVRRP}}`}}
117+
{{`{{ .Cluster.Name }}`}}_INGRESS_{{`{{$i}}`}}
118+
{{`{{ end }}`}}
119+
{{`{{ end }}`}}
120+
}
121+
track_script {
122+
chk_ingress
123+
chk_ingress_ready
124+
chk_default_ingress
125+
}
126+
}
127+
{{- end}}
128+
72129
{{`{{ range $i, $config := .Configs }}`}}
73130
{{`{{$nonVirtualIP := .NonVirtualIP}}`}}
74131
@@ -105,11 +162,13 @@ contents:
105162
virtual_ipaddress {
106163
{{`{{ .Cluster.APIVIP }}`}}/{{`{{ .Cluster.VIPNetmask }}`}} label vip
107164
}
165+
{{- if not (and (eq .Infra.Status.PlatformStatus.Type "OpenStack") (or (eq .IPFamilies "DualStack") (eq .IPFamilies "DualStackIPv6Primary"))) }}
108166
track_script {
109167
chk_ocp_lb
110168
chk_ocp_both
111169
chk_mcs
112170
}
171+
{{- end}}
113172
}
114173
{{`{{end}}`}}
115174
@@ -146,11 +205,13 @@ contents:
146205
virtual_ipaddress {
147206
{{`{{ .Cluster.IngressVIP }}`}}/{{`{{ .Cluster.VIPNetmask }}`}} label vip
148207
}
208+
{{- if not (and (eq .Infra.Status.PlatformStatus.Type "OpenStack") (or (eq .IPFamilies "DualStack") (eq .IPFamilies "DualStackIPv6Primary"))) }}
149209
track_script {
150210
chk_ingress
151211
chk_ingress_ready
152212
chk_default_ingress
153213
}
214+
{{- end}}
154215
}
155216
{{`{{ end }}`}}
156217
{{`{{ end }}`}}

Diff for: templates/worker/00-worker/on-prem/files/keepalived-keepalived.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,38 @@ contents:
3434
fall 2
3535
}
3636
37+
{{- if and (eq .Infra.Status.PlatformStatus.Type "OpenStack") (or (eq .IPFamilies "DualStack") (eq .IPFamilies "DualStackIPv6Primary")) }}
38+
# When using dual-stack with OpenStack, both IPv4 and IPv6 share the same Neutron Port,
39+
# causing OVN to assume both addresses belong to the same node, which may not always be the case.
40+
# To address this, we ensure that the API VIPs remain grouped through state changes,
41+
# the same goes for Ingress VIPs.
42+
vrrp_sync_group VG_INGRESS {
43+
group {
44+
{{`{{ range $i, $config := .Configs }}`}}
45+
{{`{{$nonVirtualIP := .NonVirtualIP}}`}}
46+
47+
{{`{{$participateInIngressVRRP := not .EnableUnicast}}`}}
48+
{{`{{- if .EnableUnicast}}
49+
{{- range .IngressConfig.Peers}}
50+
{{- if eq $nonVirtualIP .}}
51+
{{$participateInIngressVRRP = true}}
52+
{{- end}}
53+
{{- end}}
54+
{{- end}}`}}
55+
56+
{{`{{if $participateInIngressVRRP}}`}}
57+
{{`{{ .Cluster.Name }}`}}_INGRESS_{{`{{$i}}`}}
58+
{{`{{ end }}`}}
59+
{{`{{ end }}`}}
60+
}
61+
track_script {
62+
chk_ingress
63+
chk_ingress_ready
64+
chk_default_ingress
65+
}
66+
}
67+
{{- end}}
68+
3769
{{`{{ range $i, $config := .Configs }}`}}
3870
{{`{{$nonVirtualIP := .NonVirtualIP}}`}}
3971
@@ -70,11 +102,13 @@ contents:
70102
virtual_ipaddress {
71103
{{`{{ .Cluster.IngressVIP }}`}}/{{`{{ .Cluster.VIPNetmask }}`}} label vip
72104
}
105+
{{- if not (and (eq .Infra.Status.PlatformStatus.Type "OpenStack") (or (eq .IPFamilies "DualStack") (eq .IPFamilies "DualStackIPv6Primary"))) }}
73106
track_script {
74107
chk_ingress
75108
chk_ingress_ready
76109
chk_default_ingress
77110
}
111+
{{- end}}
78112
}
79113
{{`{{ end }}`}}
80114
{{`{{ end }}`}}

0 commit comments

Comments
 (0)