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 Nov 12, 2024
1 parent e806b53 commit 92a0d95
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 @@ -210,7 +210,13 @@ func (c *Controller) handleUpdateIptablesEip(key string) error {
if !cachedEip.DeletionTimestamp.IsZero() {
klog.Infof("clean eip %q in pod", key)
if vpcNatEnabled == "true" {
if err = c.deleteEipInPod(cachedEip.Spec.NatGwDp, v4Cidr); err != nil {
v4ipCidr, err := util.GetIPAddrWithMask(cachedEip.Status.IP, v4Cidr)
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 92a0d95

Please sign in to comment.