Skip to content

Commit

Permalink
fix: eip deletion (#2118)
Browse files Browse the repository at this point in the history
When eip and routed annotation deleted the nat and route rule are not deleted.
  • Loading branch information
oilbeater committed Dec 4, 2022
1 parent 86f75c8 commit 141c4c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,10 @@ func (c *Controller) handleUpdatePod(key string) error {
klog.Errorf("failed to add static route, %v", err)
return err
}
} else {
if err := c.ovnLegacyClient.DeleteStaticRoute(podIP, c.config.ClusterRouter); err != nil {
return err
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/ovs/ovn-nbctl-legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,8 +1169,8 @@ func parseLrRouteListOutput(output string) (routeList []*StaticRoute, err error)

func (c LegacyClient) UpdateNatRule(policy, logicalIP, externalIP, router, logicalMac, port string) error {
// when dual protocol pod has eip or snat, will add nat for all dual addresses.
// will failed when logicalIP externalIP is different protocol.
if util.CheckProtocol(logicalIP) != util.CheckProtocol(externalIP) {
// will fail when logicalIP externalIP is different protocol.
if externalIP != "" && util.CheckProtocol(logicalIP) != util.CheckProtocol(externalIP) {
return nil
}

Expand Down

0 comments on commit 141c4c3

Please sign in to comment.