Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add u2o test case #2203

Merged
merged 5 commits into from
Jan 6, 2023
Merged

add u2o test case #2203

merged 5 commits into from
Jan 6, 2023

Conversation

changluyi
Copy link
Collaborator

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes:

Fixes #2050

@changluyi changluyi added the test automation tests label Dec 30, 2022
@changluyi changluyi force-pushed the u2o_test_case branch 2 times, most recently from b879dcf to 79911d9 Compare December 30, 2022 09:44
Comment on lines +438 to +549
restartCmd := "kubectl rollout restart deployment kube-ovn-controller -n kube-system"
_, err = exec.Command("bash", "-c", restartCmd).CombinedOutput()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the golang client to restart the deployment.

framework.ExpectEqual(int(subnet.Status.V4UsingIPs), 1)
}

agStr := strings.Replace(fmt.Sprintf("%s.u2o_exclude_ip.ip4", subnet.Name), "-", ".", -1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
agStr := strings.Replace(fmt.Sprintf("%s.u2o_exclude_ip.ip4", subnet.Name), "-", ".", -1)
asName := strings.Replace(fmt.Sprintf("%s.u2o_exclude_ip.ip4", subnet.Name), "-", ".", -1)

modifiedSubnet := subnet.DeepCopy()
modifiedSubnet.Spec.U2OInterconnection = false
subnetClient.PatchSync(subnet, modifiedSubnet)
time.Sleep(5 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why sleep 5s here? To wait for the subnet to be ready?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if create a pod and subnet adding or updating at the same time, it will trigger IP count error sometimes. and This problem seems to have always existed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should wait until the subnet is ready instead of sleeping a period.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if create a pod and subnet adding or updating at the same time, it will trigger IP count error sometimes. and This problem seems to have always existed

I think this is a bug. Sometimes a user creates subnet(s) and pod(s) using a single YAML file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I describe it wrong, it causes errors only in updating the subnet, but not creating the subnet.

because when you update the subnet, the subnet status is always ready.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about waiting for .status.u2OInterconnectionIP to be changed?

Copy link
Collaborator Author

@changluyi changluyi Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may not work, status.u2oInterconnectionIP is changed after function reconcileU2OInterconnectionIP

and if there is a pod added after the time subnet executes reconcileU2OInterconnectionIP and before the subnet update function handleAddOrUpdateSubnet ends, the subnet usingIps count may not include this pod.

I originally used sleep to do a workaround, because once the u2o switch is switched, all pods have to be rebuilt

Comment on lines 669 to 670
v4UPodIP, v6UPodIP := util.SplitStringIP(underlayPod.Status.PodIP)
v4OPodIP, v6OPodIP := util.SplitStringIP(overlayPod.Status.PodIP)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pod.Status.PodIPs.

@@ -22,6 +25,7 @@ import (
)

const dockerNetworkName = "kube-ovn-vlan"
const curlListenPort = 8081
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK to use a fixed port, but it would be better to use a random one.

output, _ := exec.Command("bash", "-c", pingCmd).CombinedOutput()
ginkgo.By("checking curl reachable")
cmd := fmt.Sprintf("kubectl exec %s -n %s -- curl -q -s --connect-timeout 5 %s/clientip", podName, podNamespace, net.JoinHostPort(targetIP, targetPort))
output, _ := exec.Command("bash", "-c", cmd).CombinedOutput()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check the error.

Comment on lines 640 to 658
isDefaultRouteExist := false
for _, route := range routes {
if route.Dst == "default" {
if util.CheckProtocol(route.Gateway) == apiv1.ProtocolIPv4 {
if isEnableU2O {
framework.ExpectEqual(route.Gateway, v4InterconnIp)
} else {
framework.ExpectEqual(route.Gateway, v4gw)
}
} else {
if isEnableU2O {
framework.ExpectEqual(route.Gateway, v6InterconnIp)
} else {
framework.ExpectEqual(route.Gateway, v6gw)
}
}
isDefaultRouteExist = true
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check BOTH IPv4 and IPv6 for a dual-stack pod.

@changluyi changluyi merged commit 67024ec into master Jan 6, 2023
@changluyi changluyi deleted the u2o_test_case branch January 6, 2023 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test automation tests
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Interconnection between overlay and underlay subnet.
2 participants