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 12, 2023
1 parent 9d88e49 commit 97a3e1b
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -1788,6 +1788,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 @@ -1813,19 +1814,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 97a3e1b

Please sign in to comment.