Skip to content

Commit

Permalink
static ip in exclude-ips can be allocated normally when subnet's avai…
Browse files Browse the repository at this point in the history
…lableIPs is 0 #3031
  • Loading branch information
hongzhen-ma committed Jul 13, 2023
1 parent 58eef01 commit a29d00c
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions pkg/controller/pod.go
Expand Up @@ -1709,6 +1709,7 @@ func (c *Controller) getNameByPod(pod *v1.Pod) string {
return pod.Name
}

// 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.
func (c *Controller) getNsAvailableSubnets(pod *v1.Pod, podNet *kubeovnNet) ([]*kubeovnNet, error) {
var result []*kubeovnNet
// keep the annotation subnet of the pod in first position
Expand All @@ -1734,19 +1735,6 @@ func (c *Controller) getNsAvailableSubnets(pod *v1.Pod, podNet *kubeovnNet) ([]*
return nil, err
}

switch subnet.Spec.Protocol {
case kubeovnv1.ProtocolIPv4:
fallthrough
case kubeovnv1.ProtocolDual:
if subnet.Status.V4AvailableIPs == 0 {
continue
}
case kubeovnv1.ProtocolIPv6:
if subnet.Status.V6AvailableIPs == 0 {
continue
}
}

result = append(result, &kubeovnNet{
Type: providerTypeOriginal,
ProviderName: subnet.Spec.Provider,
Expand Down

0 comments on commit a29d00c

Please sign in to comment.