test/e2e/*: default existing tests to privileged pod security policy

This is to ensure that all existing tests don't break when defaulting
the pod security policy to restricted in the e2e test framework.
This commit is contained in:
Sergiusz Urbaniak
2022-04-04 14:00:06 +02:00
parent f578b9a40d
commit 1495c9f2cd
168 changed files with 351 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ package kubeadm
import (
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
)
@@ -32,6 +33,7 @@ var _ = Describe("bootstrap signer", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("bootstrap token")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -23,6 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -43,6 +44,7 @@ var _ = Describe("bootstrap token", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("bootstrap token")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -21,6 +21,7 @@ import (
rbacv1 "k8s.io/api/rbac/v1"
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -48,6 +49,7 @@ var _ = Describe("cluster-info ConfigMap", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("cluster-info")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -24,6 +24,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -42,6 +43,7 @@ var _ = Describe("control-plane node", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("control-plane node")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -19,6 +19,7 @@ package kubeadm
import (
"k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -48,6 +49,7 @@ var _ = Describe("DNS addon", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("DNS")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -23,6 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -54,6 +55,7 @@ var _ = Describe("kubeadm-certs [copy-certs]", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("kubeadm-certs")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -22,6 +22,7 @@ import (
rbacv1 "k8s.io/api/rbac/v1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -50,6 +51,7 @@ var _ = Describe("kubeadm-config ConfigMap", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("kubeadm-config")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -24,6 +24,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -53,6 +54,7 @@ var _ = Describe("kubelet-config ConfigMap", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("kubelet-config")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -23,6 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
admissionapi "k8s.io/pod-security-admission/api"
netutils "k8s.io/utils/net"
"github.com/onsi/ginkgo"
@@ -41,6 +42,7 @@ var _ = Describe("networking [setup-networking]", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("networking")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -21,6 +21,7 @@ import (
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -39,6 +40,7 @@ var _ = Describe("nodes", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("nodes")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution

View File

@@ -20,6 +20,7 @@ import (
authv1 "k8s.io/api/authorization/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
@@ -52,6 +53,7 @@ var _ = Describe("proxy addon", func() {
// Get an instance of the k8s test framework
f := framework.NewDefaultFramework("proxy")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
// Tests in this container are not expected to create new objects in the cluster
// so we are disabling the creation of a namespace in order to get a faster execution