From cf7c98262f383afe6756e9af10dfd09b7208e151 Mon Sep 17 00:00:00 2001 From: bobz965 Date: Sat, 1 Jun 2024 17:17:02 +0800 Subject: [PATCH] ovn vpc nat gw e2e only run after 1.12 (#4110) * ovn vpc nat gw e2e only run after 1.12 --------- Signed-off-by: bobz965 --- pkg/controller/ovn_eip.go | 21 +++++++++++++-------- test/e2e/ovn-vpc-nat-gw/e2e_test.go | 7 +++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pkg/controller/ovn_eip.go b/pkg/controller/ovn_eip.go index 7ff89f526fa..1e7c2b71633 100644 --- a/pkg/controller/ovn_eip.go +++ b/pkg/controller/ovn_eip.go @@ -368,7 +368,7 @@ func (c *Controller) handleDelOvnEip(key string) error { return nil } -func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usage string) error { +func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usageType string) error { cachedEip, err := c.ovnEipsLister.Get(key) if err != nil { if k8serrors.IsNotFound(err) { @@ -377,8 +377,9 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usage Name: key, Labels: map[string]string{ util.SubnetNameLabel: subnet, - util.OvnEipTypeLabel: usage, + util.OvnEipTypeLabel: usageType, util.EipV4IpLabel: v4ip, + util.EipV6IpLabel: v6ip, }, }, Spec: kubeovnv1.OvnEipSpec{ @@ -386,7 +387,7 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usage V4Ip: v4ip, V6Ip: v6ip, MacAddress: mac, - Type: usage, + Type: usageType, }, }, metav1.CreateOptions{}) if err != nil { @@ -416,8 +417,8 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usage ovnEip.Spec.V6Ip = v6ip needUpdate = true } - if usage != "" && ovnEip.Spec.Type != usage { - ovnEip.Spec.Type = usage + if usageType != "" && ovnEip.Spec.Type != usageType { + ovnEip.Spec.Type = usageType needUpdate = true } if needUpdate { @@ -440,8 +441,8 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usage ovnEip.Status.MacAddress = mac needPatch = true } - if ovnEip.Status.Type == "" && ovnEip.Status.Type != usage { - ovnEip.Status.Type = usage + if ovnEip.Status.Type == "" && ovnEip.Status.Type != usageType { + ovnEip.Status.Type = usageType needPatch = true } if needPatch { @@ -466,14 +467,18 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usage op = "add" ovnEip.Labels = map[string]string{ util.SubnetNameLabel: subnet, - util.OvnEipTypeLabel: usage, + util.OvnEipTypeLabel: usageType, util.EipV4IpLabel: v4ip, + util.EipV6IpLabel: v6ip, } needUpdateLabel = true } if ovnEip.Labels[util.SubnetNameLabel] != subnet { op = "replace" ovnEip.Labels[util.SubnetNameLabel] = subnet + ovnEip.Labels[util.OvnEipTypeLabel] = usageType + ovnEip.Labels[util.EipV4IpLabel] = v4ip + ovnEip.Labels[util.EipV6IpLabel] = v6ip needUpdateLabel = true } if needUpdateLabel { diff --git a/test/e2e/ovn-vpc-nat-gw/e2e_test.go b/test/e2e/ovn-vpc-nat-gw/e2e_test.go index 4e88b7dcd0d..ce3d24c8279 100644 --- a/test/e2e/ovn-vpc-nat-gw/e2e_test.go +++ b/test/e2e/ovn-vpc-nat-gw/e2e_test.go @@ -461,6 +461,7 @@ var _ = framework.Describe("[group:ovn-vpc-nat-gw]", func() { }) framework.ConformanceIt("Test ovn eip fip snat dnat", func() { + f.SkipVersionPriorTo(1, 13, "This feature was introduced in v1.13") ginkgo.By("Getting docker network " + dockerNetworkName) network, err := docker.NetworkInspect(dockerNetworkName) framework.ExpectNoError(err, "getting docker network "+dockerNetworkName) @@ -817,8 +818,10 @@ var _ = framework.Describe("[group:ovn-vpc-nat-gw]", func() { ginkgo.By("Create dnat, fip, snat with eip name and ip or ip cidr") for _, nodeName := range nodeNames { - ginkgo.By("Creating ovn node-ext-gw type eip on node " + nodeName) - eip := makeOvnEip(nodeName, underlaySubnetName, "", "", "", util.OvnEipTypeLSP) + // in this case, each node has one ecmp bfd ovs lsp nic + eipName := nodeName + ginkgo.By("Creating ovn node-ext-gw type eip " + nodeName) + eip := makeOvnEip(eipName, underlaySubnetName, "", "", "", util.OvnEipTypeLSP) _ = ovnEipClient.CreateSync(eip) }