-
Notifications
You must be signed in to change notification settings - Fork 450
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
add u2o test case #2203
Conversation
b879dcf
to
79911d9
Compare
restartCmd := "kubectl rollout restart deployment kube-ovn-controller -n kube-system" | ||
_, err = exec.Command("bash", "-c", restartCmd).CombinedOutput() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
79911d9
to
36df155
Compare
modifiedSubnet := subnet.DeepCopy() | ||
modifiedSubnet.Spec.U2OInterconnection = false | ||
subnetClient.PatchSync(subnet, modifiedSubnet) | ||
time.Sleep(5 * time.Second) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
v4UPodIP, v6UPodIP := util.SplitStringIP(underlayPod.Status.PodIP) | ||
v4OPodIP, v6OPodIP := util.SplitStringIP(overlayPod.Status.PodIP) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check the error.
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 | ||
} | ||
} |
There was a problem hiding this comment.
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.
What type of this PR
Examples of user facing changes:
Which issue(s) this PR fixes:
Fixes #2050