mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #73403 from hello2mao/reduce-hard-code
Reduce hard code to avoid more mistakes
This commit is contained in:
commit
153bc23365
@ -65,6 +65,7 @@ go_library(
|
||||
"//pkg/kubelet/sysctl:go_default_library",
|
||||
"//pkg/kubelet/util/format:go_default_library",
|
||||
"//pkg/master/ports:go_default_library",
|
||||
"//pkg/registry/core/service/portallocator:go_default_library",
|
||||
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
||||
"//pkg/scheduler/metrics:go_default_library",
|
||||
"//pkg/scheduler/nodeinfo:go_default_library",
|
||||
|
@ -40,6 +40,7 @@ import (
|
||||
"k8s.io/client-go/util/retry"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||
"k8s.io/kubernetes/pkg/registry/core/service/portallocator"
|
||||
testutils "k8s.io/kubernetes/test/utils"
|
||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||
|
||||
@ -557,7 +558,7 @@ func (j *ServiceTestJig) ChangeServiceNodePortOrFail(namespace, name string, ini
|
||||
service, err = j.UpdateService(namespace, name, func(s *v1.Service) {
|
||||
s.Spec.Ports[0].NodePort = int32(newPort)
|
||||
})
|
||||
if err != nil && strings.Contains(err.Error(), "provided port is already allocated") {
|
||||
if err != nil && strings.Contains(err.Error(), portallocator.ErrAllocated.Error()) {
|
||||
Logf("tried nodePort %d, but it is in use, will try another", newPort)
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user