Skip to content

Commit

Permalink
Remove the VPC while removing the default subnet
Browse files Browse the repository at this point in the history
  • Loading branch information
fanriming committed Nov 4, 2020
1 parent 99217ce commit 7a0e28b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,12 @@ func (c *Controller) handleDeleteSubnet(key string) error {
// The default VPC subnet should be removed last
return fmt.Errorf("the default VPC subnet should be removed last")
}

err = c.deleteCustomVpc(vpc.Name)
if err != nil {
klog.Errorf("failed to delete vpc %v", err)
return err
}
}

c.ipam.DeleteSubnet(key)
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (c *Controller) deleteCustomVpc(name string) error {
klog.Errorf("delete router failed %v", err)
return err
}
c.vpcs.Delete(vpc.Name)
return nil
}

Expand Down

0 comments on commit 7a0e28b

Please sign in to comment.