mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Fix service's nodePort already allocated
Signed-off-by: carlory <baofa.fan@daocloud.io>
This commit is contained in:
parent
14dafc30c9
commit
8eb31f8aa1
@ -1703,7 +1703,7 @@ var _ = common.SIGDescribe("Services", func() {
|
||||
}
|
||||
break
|
||||
}
|
||||
if apierrors.IsConflict(err) {
|
||||
if apierrors.IsInvalid(err) {
|
||||
framework.Logf("node port %d is already allocated to other service, retrying ... : %v", port, err)
|
||||
continue
|
||||
}
|
||||
@ -3979,7 +3979,7 @@ var _ = common.SIGDescribe("Services", func() {
|
||||
}
|
||||
break
|
||||
}
|
||||
if apierrors.IsConflict(err) {
|
||||
if apierrors.IsInvalid(err) {
|
||||
framework.Logf("node port %d is already allocated to other service, retrying ... : %v", port, err)
|
||||
continue
|
||||
}
|
||||
@ -3987,7 +3987,12 @@ var _ = common.SIGDescribe("Services", func() {
|
||||
|
||||
}
|
||||
|
||||
defer e2eservice.ReleaseStaticNodePort(svc.Spec.HealthCheckNodePort)
|
||||
ginkgo.DeferCleanup(func(ctx context.Context) {
|
||||
err := cs.CoreV1().Services(namespace).Delete(ctx, serviceName, metav1.DeleteOptions{})
|
||||
framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, namespace)
|
||||
e2eservice.ReleaseStaticNodePort(svc.Spec.HealthCheckNodePort)
|
||||
})
|
||||
|
||||
nodePortStr := fmt.Sprintf("%d", svc.Spec.Ports[0].NodePort)
|
||||
hcNodePortStr := fmt.Sprintf("%d", svc.Spec.HealthCheckNodePort)
|
||||
framework.Logf("NodePort is %s, HealthCheckNodePort is %s", nodePortStr, hcNodePortStr)
|
||||
|
Loading…
Reference in New Issue
Block a user