mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-09-28 10:45:40 +00:00
Make Pinniped compatible with Kube clusters which have enabled PSAs
Where possible, use securityContext settings which will work with the most restrictive Pod Security Admission policy level (as of Kube 1.25). Where privileged containers are needed, use the namespace-level annotation to allow them. Also adjust some integration tests to make similar changes to allow the integration tests to pass on test clusters which use restricted PSAs.
This commit is contained in:
@@ -949,6 +949,8 @@ func TestImpersonationProxy(t *testing.T) { //nolint:gocyclo // yeah, it's compl
|
||||
Image: env.ShellContainerImage,
|
||||
ImagePullPolicy: corev1.PullIfNotPresent,
|
||||
Command: []string{"sh", "-c", "sleep 3600"},
|
||||
// Use a restrictive security context just in case the test cluster has PSAs enabled.
|
||||
SecurityContext: testlib.RestrictiveSecurityContext(),
|
||||
},
|
||||
},
|
||||
ServiceAccountName: saName,
|
||||
@@ -1090,6 +1092,8 @@ func TestImpersonationProxy(t *testing.T) { //nolint:gocyclo // yeah, it's compl
|
||||
corev1.ResourceCPU: resource.MustParse("10m"),
|
||||
},
|
||||
},
|
||||
// Use a restrictive security context just in case the test cluster has PSAs enabled.
|
||||
SecurityContext: testlib.RestrictiveSecurityContext(),
|
||||
}}})
|
||||
|
||||
// Try "kubectl exec" through the impersonation proxy.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved.
|
||||
// Copyright 2020-2022 the Pinniped contributors. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
package integration
|
||||
|
||||
@@ -176,6 +176,8 @@ func TestWhoAmI_ServiceAccount_TokenRequest_Parallel(t *testing.T) {
|
||||
Image: env.ShellContainerImage,
|
||||
ImagePullPolicy: corev1.PullIfNotPresent,
|
||||
Command: []string{"sh", "-c", "sleep 3600"},
|
||||
// Use a restrictive security context just in case the test cluster has PSAs enabled.
|
||||
SecurityContext: testlib.RestrictiveSecurityContext(),
|
||||
},
|
||||
},
|
||||
ServiceAccountName: sa.Name,
|
||||
|
||||
Reference in New Issue
Block a user