mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Merge pull request #129522 from carlory/fix-129520
Fix service's nodePort already allocated
This commit is contained in:
commit
732fc190d0
@ -1703,7 +1703,7 @@ var _ = common.SIGDescribe("Services", func() {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if apierrors.IsConflict(err) {
|
if apierrors.IsInvalid(err) {
|
||||||
framework.Logf("node port %d is already allocated to other service, retrying ... : %v", port, err)
|
framework.Logf("node port %d is already allocated to other service, retrying ... : %v", port, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -3979,7 +3979,7 @@ var _ = common.SIGDescribe("Services", func() {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if apierrors.IsConflict(err) {
|
if apierrors.IsInvalid(err) {
|
||||||
framework.Logf("node port %d is already allocated to other service, retrying ... : %v", port, err)
|
framework.Logf("node port %d is already allocated to other service, retrying ... : %v", port, err)
|
||||||
continue
|
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)
|
nodePortStr := fmt.Sprintf("%d", svc.Spec.Ports[0].NodePort)
|
||||||
hcNodePortStr := fmt.Sprintf("%d", svc.Spec.HealthCheckNodePort)
|
hcNodePortStr := fmt.Sprintf("%d", svc.Spec.HealthCheckNodePort)
|
||||||
framework.Logf("NodePort is %s, HealthCheckNodePort is %s", nodePortStr, hcNodePortStr)
|
framework.Logf("NodePort is %s, HealthCheckNodePort is %s", nodePortStr, hcNodePortStr)
|
||||||
|
Loading…
Reference in New Issue
Block a user