Skip to content

Commit

Permalink
fix: should delete subnet before vpc (#4370)
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 committed Aug 8, 2024
1 parent 96e4aed commit 5baabfb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/controller/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ func (c *Controller) handleDelVpc(vpc *kubeovnv1.Vpc) error {
defer func() { _ = c.vpcKeyMutex.UnlockKey(vpc.Name) }()
klog.Infof("handle delete vpc %s", vpc.Name)

// should delete vpc subnets first
if len(vpc.Status.Subnets) != 0 {
err := fmt.Errorf("failed to delete vpc %s, still has subnets %v", vpc.Name, vpc.Status.Subnets)
klog.Error(err)
return err
}

if err := c.deleteVpcLb(vpc); err != nil {
klog.Error(err)
return err
Expand Down

0 comments on commit 5baabfb

Please sign in to comment.