Skip to content

Commit 059dee3

Browse files
committed
Allow ImageVolume for Restricted PSA profiles
Stop referring to ImageVolume as an unknown type during pod security admission validation. Avoid restricting ImageVolume for the Restricted profile, as users who can create a pod with a certain image should also be able to use ImageVolume with an image. Signed-off-by: bmordeha <[email protected]>
1 parent 7bd0477 commit 059dee3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

staging/src/k8s.io/pod-security-admission/policy/check_restrictedVolumes.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ limits usage of inline pod volume sources to:
3636
* csi
3737
* persistentVolumeClaim
3838
* ephemeral
39+
* image
3940
4041
**Restricted Fields:**
4142
@@ -95,6 +96,7 @@ func restrictedVolumes_1_0(podMetadata *metav1.ObjectMeta, podSpec *corev1.PodSp
9596
volume.DownwardAPI != nil,
9697
volume.EmptyDir != nil,
9798
volume.Ephemeral != nil,
99+
volume.Image != nil,
98100
volume.PersistentVolumeClaim != nil,
99101
volume.Projected != nil,
100102
volume.Secret != nil:

staging/src/k8s.io/pod-security-admission/policy/check_restrictedVolumes_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func TestRestrictedVolumes(t *testing.T) {
4242
{Name: "a6", VolumeSource: corev1.VolumeSource{Projected: &corev1.ProjectedVolumeSource{}}},
4343
{Name: "a7", VolumeSource: corev1.VolumeSource{CSI: &corev1.CSIVolumeSource{}}},
4444
{Name: "a8", VolumeSource: corev1.VolumeSource{Ephemeral: &corev1.EphemeralVolumeSource{}}},
45+
{Name: "a9", VolumeSource: corev1.VolumeSource{Image: &corev1.ImageVolumeSource{}}},
4546

4647
// known restricted types
4748
{Name: "b1", VolumeSource: corev1.VolumeSource{HostPath: &corev1.HostPathVolumeSource{}}},

0 commit comments

Comments
 (0)