mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
test/e2e/framework /service and /pv:remove direct dependency to k8s.io/kubernetes/pkg/
This commit is contained in:
parent
5d4553a90d
commit
9b9b27d768
@ -6,7 +6,6 @@ go_library(
|
||||
importpath = "k8s.io/kubernetes/test/e2e/framework/pv",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/volume/util:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
|
@ -29,7 +29,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/kubernetes/pkg/volume/util"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
||||
)
|
||||
@ -60,6 +59,11 @@ const (
|
||||
// betaIsDefaultStorageClassAnnotation is the beta version of IsDefaultStorageClassAnnotation.
|
||||
// TODO: remove Beta when no longer used
|
||||
betaIsDefaultStorageClassAnnotation = "storageclass.beta.kubernetes.io/is-default-class"
|
||||
|
||||
// volumeGidAnnotationKey is the of the annotation on the PersistentVolume
|
||||
// object that specifies a supplemental GID.
|
||||
// it is copied from k8s.io/kubernetes/pkg/volume/util VolumeGidAnnotationKey
|
||||
volumeGidAnnotationKey = "pv.beta.kubernetes.io/gid"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -577,7 +581,7 @@ func MakePersistentVolume(pvConfig PersistentVolumeConfig) *v1.PersistentVolume
|
||||
GenerateName: pvConfig.NamePrefix,
|
||||
Labels: pvConfig.Labels,
|
||||
Annotations: map[string]string{
|
||||
util.VolumeGidAnnotationKey: "777",
|
||||
volumeGidAnnotationKey: "777",
|
||||
},
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
|
@ -12,7 +12,6 @@ go_library(
|
||||
importpath = "k8s.io/kubernetes/test/e2e/framework/service",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/registry/core/service/portallocator:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
|
@ -18,6 +18,7 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"regexp"
|
||||
@ -41,7 +42,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/kubernetes/pkg/registry/core/service/portallocator"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2enetwork "k8s.io/kubernetes/test/e2e/framework/network"
|
||||
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
||||
@ -54,6 +54,9 @@ import (
|
||||
// NodePortRange should match whatever the default/configured range is
|
||||
var NodePortRange = utilnet.PortRange{Base: 30000, Size: 2768}
|
||||
|
||||
// It is copied from "k8s.io/kubernetes/pkg/registry/core/service/portallocator"
|
||||
var errAllocated = errors.New("provided port is already allocated")
|
||||
|
||||
// TestJig is a test jig to help service testing.
|
||||
type TestJig struct {
|
||||
Client clientset.Interface
|
||||
@ -476,7 +479,7 @@ func (j *TestJig) ChangeServiceNodePort(initial int) (*v1.Service, error) {
|
||||
service, err = j.UpdateService(func(s *v1.Service) {
|
||||
s.Spec.Ports[0].NodePort = int32(newPort)
|
||||
})
|
||||
if err != nil && strings.Contains(err.Error(), portallocator.ErrAllocated.Error()) {
|
||||
if err != nil && strings.Contains(err.Error(), errAllocated.Error()) {
|
||||
framework.Logf("tried nodePort %d, but it is in use, will try another", newPort)
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user