Skip to content

Commit

Permalink
fix vpc already delete while delete policy route
Browse files Browse the repository at this point in the history
  • Loading branch information
bobz965 committed Jul 3, 2023
1 parent 1236693 commit 3a7e127
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2532,6 +2532,11 @@ func (c *Controller) addPolicyRouteForU2OInterconn(subnet *kubeovnv1.Subnet) err
}

func (c *Controller) deletePolicyRouteForU2OInterconn(subnet *kubeovnv1.Subnet) error {
logicalRouter, err := c.ovnClient.GetLogicalRouter(subnet.Spec.Vpc, true)
if err == nil && logicalRouter == nil {
klog.Infof("logical router %s already deleted", subnet.Spec.Vpc)
return nil
}
policies, err := c.ovnClient.ListLogicalRouterPolicies(subnet.Spec.Vpc, -1, map[string]string{
"isU2ORoutePolicy": "true",
"vendor": util.CniTypeName,
Expand Down Expand Up @@ -2608,7 +2613,11 @@ func (c *Controller) addCustomVPCPolicyRoutesForSubnet(subnet *kubeovnv1.Subnet)
}

func (c *Controller) deleteCustomVPCPolicyRoutesForSubnet(subnet *kubeovnv1.Subnet) error {

logicalRouter, err := c.ovnClient.GetLogicalRouter(subnet.Spec.Vpc, true)
if err == nil && logicalRouter == nil {
klog.Infof("logical router %s already deleted", subnet.Spec.Vpc)
return nil
}
for _, cidr := range strings.Split(subnet.Spec.CIDRBlock, ",") {
af := 4
if util.CheckProtocol(cidr) == kubeovnv1.ProtocolIPv6 {
Expand Down

0 comments on commit 3a7e127

Please sign in to comment.