Skip to content

Commit

Permalink
The eip is not cleaned after eip is deleted (#4718) (#4719)
Browse files Browse the repository at this point in the history
The ip address in vpc-nat-gw pod is not cleaned after the eip
is deleted. This patch fix this problem.

Signed-off-by: Rain Suo <[email protected]>
  • Loading branch information
hackerain authored and oilbeater committed Nov 12, 2024
1 parent c328da4 commit c3e8fb4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/controller/vpc_nat_gw_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,13 @@ func (c *Controller) handleUpdateIptablesEip(key string) error {
return err
}
if vpcNatEnabled == "true" {
if err = c.deleteEipInPod(cachedEip.Spec.NatGwDp, v4Cidr); err != nil {
v4ipCidr, err := util.GetIPAddrWithMask(cachedEip.Status.IP, v4Cidr)

Check failure on line 307 in pkg/controller/vpc_nat_gw_eip.go

View workflow job for this annotation

GitHub Actions / Build arm64

assignment mismatch: 2 variables but util.GetIPAddrWithMask returns 1 value

Check failure on line 307 in pkg/controller/vpc_nat_gw_eip.go

View workflow job for this annotation

GitHub Actions / Build kube-ovn

assignment mismatch: 2 variables but util.GetIPAddrWithMask returns 1 value
if err != nil {
err = fmt.Errorf("failed to get eip %s with mask by cidr %s: %w", cachedEip.Status.IP, v4Cidr, err)
klog.Error(err)
return err
}
if err = c.deleteEipInPod(cachedEip.Spec.NatGwDp, v4ipCidr); err != nil {
klog.Errorf("failed to clean eip '%s' in pod, %v", key, err)
return err
}
Expand Down

0 comments on commit c3e8fb4

Please sign in to comment.