Skip to content

Commit

Permalink
fix: If pod has snat or eip, also need delete staticRoute when delete…
Browse files Browse the repository at this point in the history
… pod. (#1731)

Signed-off-by: xujunjie-cover <[email protected]>
(cherry picked from commit ce40f7e)
  • Loading branch information
xujunjie-cover authored and oilbeater committed Jul 22, 2022
1 parent 76e3c67 commit 70246fb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,14 @@ func (c *Controller) handleDeletePod(pod *v1.Pod) error {
} else if err != nil {
return err
}
// If pod has snat or eip, also need delete staticRoute when delete pod
if vpc.Name == util.DefaultVpc {
if err := c.ovnLegacyClient.DeleteStaticRoute(address.Ip, vpc.Name); err != nil {
return err
}
}
if exGwEnabled == "true" {
if err := c.ovnLegacyClient.DeleteNatRule(address.Ip, vpc.Status.Router); err != nil {
if err := c.ovnLegacyClient.DeleteNatRule(address.Ip, vpc.Name); err != nil {
return err
}
}
Expand Down

0 comments on commit 70246fb

Please sign in to comment.