Skip to content

Commit

Permalink
fix: calculate usings before removed finalizer (#3570)
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 authored Dec 23, 2023
1 parent ef35f62 commit c6fefd4
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,23 +708,13 @@ func (c *Controller) handleAddOrUpdateSubnet(key string) error {
return err
}
klog.V(3).Infof("handle add or update subnet %s", cachedSubnet.Name)

subnet := cachedSubnet.DeepCopy()
subnet, err = c.formatSubnet(subnet)
if err != nil {
klog.Error(err)
return err
}

deleted, err := c.handleSubnetFinalizer(subnet)
if err != nil {
klog.Errorf("handle subnet finalizer failed %v", err)
return err
}
if deleted {
return nil
}

if err = util.ValidateSubnet(*subnet); err != nil {
klog.Errorf("failed to validate subnet %s, %v", subnet.Name, err)
c.patchSubnetStatus(subnet, "ValidateLogicalSwitchFailed", err.Error())
Expand All @@ -747,6 +737,15 @@ func (c *Controller) handleAddOrUpdateSubnet(key string) error {
return err
}

deleted, err := c.handleSubnetFinalizer(subnet)
if err != nil {
klog.Errorf("handle subnet finalizer failed %v", err)
return err
}
if deleted {
return nil
}

if !isOvnSubnet(subnet) {
// subnet provider is not ovn, and vpc is empty, should not reconcile
c.patchSubnetStatus(subnet, "SetNonOvnSubnetSuccess", "")
Expand Down

0 comments on commit c6fefd4

Please sign in to comment.