test/framework: psp.go skipper.go remove direct import /k8s.io/kubernetes/pkg
This commit is contained in:
		@@ -31,7 +31,6 @@ go_library(
 | 
			
		||||
        "//pkg/kubelet/apis/stats/v1alpha1:go_default_library",
 | 
			
		||||
        "//pkg/kubelet/events:go_default_library",
 | 
			
		||||
        "//pkg/kubelet/sysctl:go_default_library",
 | 
			
		||||
        "//pkg/security/podsecuritypolicy/seccomp:go_default_library",
 | 
			
		||||
        "//pkg/util/taints:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/api/apps/v1:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/api/core/v1:go_default_library",
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,6 @@ import (
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
			
		||||
	"k8s.io/apiserver/pkg/authentication/serviceaccount"
 | 
			
		||||
	clientset "k8s.io/client-go/kubernetes"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/security/podsecuritypolicy/seccomp"
 | 
			
		||||
 | 
			
		||||
	"github.com/onsi/ginkgo"
 | 
			
		||||
 | 
			
		||||
@@ -39,6 +38,12 @@ import (
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	podSecurityPolicyPrivileged = "e2e-test-privileged-psp"
 | 
			
		||||
 | 
			
		||||
	// allowAny is the wildcard used to allow any profile.
 | 
			
		||||
	allowAny = "*"
 | 
			
		||||
 | 
			
		||||
	// allowedProfilesAnnotationKey specifies the allowed seccomp profiles.
 | 
			
		||||
	allowedProfilesAnnotationKey = "seccomp.security.alpha.kubernetes.io/allowedProfileNames"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
@@ -52,7 +57,7 @@ func privilegedPSP(name string) *policyv1beta1.PodSecurityPolicy {
 | 
			
		||||
	return &policyv1beta1.PodSecurityPolicy{
 | 
			
		||||
		ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
			Name:        name,
 | 
			
		||||
			Annotations: map[string]string{seccomp.AllowedProfilesAnnotationKey: seccomp.AllowAny},
 | 
			
		||||
			Annotations: map[string]string{allowedProfilesAnnotationKey: allowAny},
 | 
			
		||||
		},
 | 
			
		||||
		Spec: policyv1beta1.PodSecurityPolicySpec{
 | 
			
		||||
			Privileged:               true,
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,6 @@ go_library(
 | 
			
		||||
    importpath = "k8s.io/kubernetes/test/e2e/framework/skipper",
 | 
			
		||||
    visibility = ["//visibility:public"],
 | 
			
		||||
    deps = [
 | 
			
		||||
        "//pkg/features:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
 | 
			
		||||
@@ -15,6 +14,7 @@ go_library(
 | 
			
		||||
        "//staging/src/k8s.io/client-go/discovery:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/client-go/dynamic:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/client-go/kubernetes:go_default_library",
 | 
			
		||||
        "//staging/src/k8s.io/component-base/featuregate:go_default_library",
 | 
			
		||||
        "//test/e2e/framework:go_default_library",
 | 
			
		||||
        "//test/e2e/framework/node:go_default_library",
 | 
			
		||||
        "//test/e2e/framework/ssh:go_default_library",
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ import (
 | 
			
		||||
	"k8s.io/client-go/discovery"
 | 
			
		||||
	"k8s.io/client-go/dynamic"
 | 
			
		||||
	clientset "k8s.io/client-go/kubernetes"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/features"
 | 
			
		||||
	"k8s.io/component-base/featuregate"
 | 
			
		||||
	"k8s.io/kubernetes/test/e2e/framework"
 | 
			
		||||
	e2enode "k8s.io/kubernetes/test/e2e/framework/node"
 | 
			
		||||
	e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
 | 
			
		||||
@@ -45,6 +45,9 @@ import (
 | 
			
		||||
// TestContext should be used by all tests to access common context data.
 | 
			
		||||
var TestContext framework.TestContextType
 | 
			
		||||
 | 
			
		||||
// New local storage types to support local storage capacity isolation
 | 
			
		||||
var localStorageCapacityIsolation featuregate.Feature = "LocalStorageCapacityIsolation"
 | 
			
		||||
 | 
			
		||||
func skipInternalf(caller int, format string, args ...interface{}) {
 | 
			
		||||
	msg := fmt.Sprintf(format, args...)
 | 
			
		||||
	framework.Logf(msg)
 | 
			
		||||
@@ -131,8 +134,8 @@ func SkipUnlessAtLeast(value int, minValue int, message string) {
 | 
			
		||||
 | 
			
		||||
// SkipUnlessLocalEphemeralStorageEnabled skips if the LocalStorageCapacityIsolation is not enabled.
 | 
			
		||||
func SkipUnlessLocalEphemeralStorageEnabled() {
 | 
			
		||||
	if !utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) {
 | 
			
		||||
		skipInternalf(1, "Only supported when %v feature is enabled", features.LocalStorageCapacityIsolation)
 | 
			
		||||
	if !utilfeature.DefaultFeatureGate.Enabled(localStorageCapacityIsolation) {
 | 
			
		||||
		skipInternalf(1, "Only supported when %v feature is enabled", localStorageCapacityIsolation)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user