Skip to content

Commit

Permalink
ovn vpc nat gw e2e only run after 1.12 (#4110)
Browse files Browse the repository at this point in the history
* ovn vpc nat gw e2e only run after 1.12

---------

Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 committed Jun 1, 2024
1 parent d62aace commit cf7c982
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
21 changes: 13 additions & 8 deletions pkg/controller/ovn_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -377,16 +377,17 @@ 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{
ExternalSubnet: subnet,
V4Ip: v4ip,
V6Ip: v6ip,
MacAddress: mac,
Type: usage,
Type: usageType,
},
}, metav1.CreateOptions{})
if err != nil {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/ovn-vpc-nat-gw/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit cf7c982

Please sign in to comment.