Merge pull request #129522 from carlory/fix-129520

Fix service's nodePort already allocated
This commit is contained in:
Kubernetes Prow Robot 2025-01-09 07:48:43 -08:00 committed by GitHub
commit 732fc190d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)