From 974f5078f13cf38ced695fb0a2dac51fb50f46a0 Mon Sep 17 00:00:00 2001 From: bobz965 Date: Thu, 30 Nov 2023 14:11:51 +0800 Subject: [PATCH 1/2] fix ovn eip not calculated Signed-off-by: bobz965 --- pkg/controller/subnet.go | 8 ++++++++ 1 file changed, 8 insertions(+) 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})) From c48e70cc0d7ff9d7139a6eb43f2d0e8bbd792026 Mon Sep 17 00:00:00 2001 From: bobz965 Date: Thu, 30 Nov 2023 18:02:11 +0800 Subject: [PATCH 2/2] fix: clean vlan subnet after clean vpc Signed-off-by: bobz965 --- test/e2e/ovn-vpc-nat-gw/e2e_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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{})