You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Allow static IPs with IPAM only for primary networks with layer2 topology when EnablePreconfiguredUDNAddresses is enabled
213
+
// Feature gate integration: EnablePreconfiguredUDNAddresses controls static IP allocation with IPAM
214
+
if!util.IsPreconfiguredUDNAddressesEnabled() {
215
+
// Feature is disabled, reject static IPs with IPAM
216
+
returnfmt.Errorf("cannot allocate a static IP request with IPAM for pod %s (custom network configuration disabled)", podDesc)
217
+
}
218
+
if!netInfo.IsPrimaryNetwork() {
219
+
// Static IP requests with IPAM are only supported on primary networks
220
+
returnfmt.Errorf("cannot allocate a static IP request with IPAM for pod %s: only supported on primary networks", podDesc)
221
+
}
222
+
ifnetInfo.TopologyType() !=types.Layer2Topology {
223
+
// Static IP requests with IPAM are only supported on layer2 topology networks.
224
+
// On other topologies, we cannot distinguish between already allocated IPs and
225
+
// IPs excluded from allocation, making it impossible to safely honor static IP
226
+
// requests when IPAM is enabled.
227
+
returnfmt.Errorf("cannot allocate a static IP request with IPAM for pod %s: layer2 topology is required, but network has topology %q", podDesc, netInfo.TopologyType())
returnfmt.Errorf("cannot allocate a static IP request with IPAM for pod %q: the pod references an ipam claim with IPs not containing the requested IP %q", podDesc, ipRequest)
233
+
}
234
+
}
235
+
}
236
+
returnnil
237
+
}
238
+
210
239
// allocatePodAnnotationWithRollback allocates the PodAnnotation which includes
211
240
// IPs, a mac address, routes, gateways and an ID. Returns the allocated pod
212
241
// annotation and a pod with that annotation set. Returns a nil pod and the existing
0 commit comments