Skip to content

Commit 97a3e1b

Browse files
authored
static ip in exclude-ips can be allocated normally when subnet's availableIPs is 0 (#3031)
1 parent 9d88e49 commit 97a3e1b

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

pkg/controller/pod.go

+1-13
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,7 @@ func (c *Controller) getNameByPod(pod *v1.Pod) string {
17881788
return pod.Name
17891789
}
17901790

1791+
// When subnet's v4availableIPs is 0 but still there's available ip in exclude-ips, the static ip in exclude-ips can be allocated normal.
17911792
func (c *Controller) getNsAvailableSubnets(pod *v1.Pod, podNet *kubeovnNet) ([]*kubeovnNet, error) {
17921793
var result []*kubeovnNet
17931794
// keep the annotation subnet of the pod in first position
@@ -1813,19 +1814,6 @@ func (c *Controller) getNsAvailableSubnets(pod *v1.Pod, podNet *kubeovnNet) ([]*
18131814
return nil, err
18141815
}
18151816

1816-
switch subnet.Spec.Protocol {
1817-
case kubeovnv1.ProtocolIPv4:
1818-
fallthrough
1819-
case kubeovnv1.ProtocolDual:
1820-
if subnet.Status.V4AvailableIPs == 0 {
1821-
continue
1822-
}
1823-
case kubeovnv1.ProtocolIPv6:
1824-
if subnet.Status.V6AvailableIPs == 0 {
1825-
continue
1826-
}
1827-
}
1828-
18291817
result = append(result, &kubeovnNet{
18301818
Type: providerTypeOriginal,
18311819
ProviderName: subnet.Spec.Provider,

0 commit comments

Comments
 (0)