diff --git a/pkg/controller/subnet.go b/pkg/controller/subnet.go index 54129824a35..9f030251e24 100644 --- a/pkg/controller/subnet.go +++ b/pkg/controller/subnet.go @@ -2097,6 +2097,14 @@ func calcSubnetStatusIP(subnet *kubeovnv1.Subnet, c *Controller) error { return err } usingIPs += float64(len(vips)) + ovnEips, err := c.ovnEipsLister.List(labels.SelectorFromSet(labels.Set{ + util.SubnetNameLabel: subnet.Name, + })) + if err != nil { + klog.Error(err) + return err + } + usingIPs += float64(len(ovnEips)) if !isOvnSubnet(subnet) { eips, err := c.iptablesEipsLister.List( labels.SelectorFromSet(labels.Set{util.SubnetNameLabel: subnet.Name})) diff --git a/test/e2e/ovn-vpc-nat-gw/e2e_test.go b/test/e2e/ovn-vpc-nat-gw/e2e_test.go index 220487da65d..b673e93a7d8 100644 --- a/test/e2e/ovn-vpc-nat-gw/e2e_test.go +++ b/test/e2e/ovn-vpc-nat-gw/e2e_test.go @@ -455,16 +455,18 @@ var _ = framework.Describe("[group:ovn-vpc-nat-gw]", func() { subnetClient.DeleteSync(noBfdExtraSubnetName) ginkgo.By("Deleting subnet " + bfdSubnetName) subnetClient.DeleteSync(bfdSubnetName) - ginkgo.By("Deleting underlay subnet " + underlaySubnetName) - subnetClient.DeleteSync(underlaySubnetName) - ginkgo.By("Deleting extra underlay subnet " + underlayExtraSubnetName) - subnetClient.DeleteSync(underlayExtraSubnetName) ginkgo.By("Deleting no bfd custom vpc " + noBfdVpcName) vpcClient.DeleteSync(noBfdVpcName) ginkgo.By("Deleting bfd custom vpc " + bfdVpcName) vpcClient.DeleteSync(bfdVpcName) + ginkgo.By("Deleting underlay vlan subnet") + ginkgo.By("Deleting underlay subnet " + underlaySubnetName) + subnetClient.DeleteSync(underlaySubnetName) + ginkgo.By("Deleting extra underlay subnet " + underlayExtraSubnetName) + subnetClient.DeleteSync(underlayExtraSubnetName) + ginkgo.By("Deleting vlan " + vlanName) vlanClient.Delete(vlanName, metav1.DeleteOptions{})