Skip to content

Commit

Permalink
fix subnet conflict check for node address
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Aug 27, 2021
1 parent 43227f1 commit 42e212c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,12 @@ func (c *Controller) handleAddOrUpdateSubnet(key string) error {
}
}

nodes, err := c.nodesLister.List(labels.Everything())
if err != nil {
klog.Errorf("failed to list nodes %v", err)
return err
}
if subnet.Spec.Vlan != "" && subnet.Spec.Vpc != util.DefaultVpc {
if subnet.Spec.Vlan == "" && subnet.Spec.Vpc == util.DefaultVpc {
nodes, err := c.nodesLister.List(labels.Everything())
if err != nil {
klog.Errorf("failed to list nodes %v", err)
return err
}
for _, node := range nodes {
for _, addr := range node.Status.Addresses {
if addr.Type == v1.NodeInternalIP && util.CIDRContainIP(subnet.Spec.CIDRBlock, addr.Address) {
Expand Down

0 comments on commit 42e212c

Please sign in to comment.