Skip to content

[BUG] IP address leak if adding EIP fails #4922

@cruickshankpg

Description

@cruickshankpg

Kube-OVN Version

v1.12.22

Kubernetes Version

v1.28.6

Operation-system/Kernel Version

"Ubuntu 22.04.5 LTS" 6.8.0-47-generic

Description

If an EIP fails to be added to a NAT gateway it allocates an IP. If the EIP is deleted before the NAT gateway comes up then the IP address allocation is leaked in IPAM. Restarting the kube-ovn-controller leader removes the leak

0110 16:34:03.854233       7 vpc_nat_gw_eip.go:208] handle add iptables eip poison-eip
I0110 16:34:03.854278       7 ipam.go:60] allocate v4 10.146.46.215, v6 , mac 72:b4:28:77:2c:b0 for poison-eip from subnet ovn-vpc-external-network
E0110 16:34:03.854395       7 vpc_nat_gw_eip.go:425] pod.apps "doesn-not-exist" not found
E0110 16:34:03.854405       7 vpc_nat_gw_eip.go:247] failed to create eip 'poison-eip' in pod, pod.apps "doesn-not-exist" not found
E0110 16:34:03.854470       7 vpc_nat_gw_eip.go:110] error syncing 'poison-eip': pod.apps "doesn-not-exist" not found, requeuing

The IP address is added to the external subnet's status' v4usingIPrange and removed from the the v4availableIPrange but v4usingIPs is not updated.

  v4availableIPrange: 10.146.46.204-10.146.46.211,10.146.46.217-10.146.46.254
  v4availableIPs: 48
  v4usingIPrange: 10.146.46.212-10.146.46.216
  v4usingIPs: 3

Steps To Reproduce

Create an eip

cat <<EOF | kubectl apply -f -
apiVersion: kubeovn.io/v1
kind: IptablesEIP
metadata:
  name: poison-eip
spec:
  natGwDp: does-not-exist
  externalSubnet: ovn-vpc-external-network
EOF

Wait a moment for it to get programmed

Delete the eip

kubectl delete eip poison-eip

Inspect the subnet status

Current Behavior

EIP IP allocation leaked

Expected Behavior

EIP IP allocation not leaked

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeipipam

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions