Skip to content

Commit 1e585ce

Browse files
committed
🐛 Envtest: Allow creating privileged containers
1 parent afac980 commit 1e585ce

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pkg/controller/controller_integration_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2525
"k8s.io/apimachinery/pkg/runtime/schema"
2626
"k8s.io/apimachinery/pkg/types"
27+
utilpointer "k8s.io/utils/pointer"
2728
"sigs.k8s.io/controller-runtime/pkg/cache"
2829
"sigs.k8s.io/controller-runtime/pkg/controller"
2930
"sigs.k8s.io/controller-runtime/pkg/handler"
@@ -100,6 +101,9 @@ var _ = Describe("controller", func() {
100101
{
101102
Name: "nginx",
102103
Image: "nginx",
104+
SecurityContext: &corev1.SecurityContext{
105+
Privileged: utilpointer.BoolPtr(true),
106+
},
103107
},
104108
},
105109
},

pkg/envtest/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ var DefaultKubeAPIServerFlags = []string{
8484
"--secure-port={{ if .SecurePort }}{{ .SecurePort }}{{ end }}",
8585
"--admission-control=AlwaysAdmit",
8686
"--service-cluster-ip-range=10.0.0.0/24",
87+
"--allow-privileged=true",
8788
}
8889

8990
// Environment creates a Kubernetes test environment that will start / stop the Kubernetes control plane and

0 commit comments

Comments
 (0)