Skip to content

Commit

Permalink
fix: reset address_set when delete subnet
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Jul 4, 2020
1 parent 84bd5ed commit e6817a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,21 @@ func (c *Controller) handleDeleteSubnet(key string) error {
}
}

subnetList, err := c.subnetsLister.List(labels.Everything())
if err != nil {
klog.Errorf("failed to list subnets %v", err)
return err
}
cidrs := make([]string, 0, len(subnetList))
for _, sub := range subnetList {
if sub.Status.IsReady() {
cidrs = append(cidrs, sub.Spec.CIDRBlock)
}
}
if err := c.ovnClient.SetAddressesToAddressSet(cidrs, util.SubnetAddressSet); err != nil {
klog.Errorf("failed to set subnet address set, %v", err)
return err
}
return nil
}

Expand Down

0 comments on commit e6817a6

Please sign in to comment.