tests: creates HostPath pods as unprivileged

The containers are mounted the /tmp folder as a HostPath volume
and they are supposed to create a new file in it.

The /tmp folder has 777 file permissions, so there shouldn't be any
problems creating a file, even if the container is unprivileged.
This commit is contained in:
Claudiu Belu 2019-03-05 06:49:15 -08:00
parent b605bb93b0
commit 4d22a51414

View File

@ -68,7 +68,9 @@ var _ = Describe("[sig-storage] HostPath", func() {
source := &v1.HostPathVolumeSource{
Path: "/tmp",
}
pod := testPodWithHostVol(volumePath, source, true)
// we can't spawn privileged containers on Windows, nor do we need to.
privileged := !framework.NodeOSDistroIs("windows")
pod := testPodWithHostVol(volumePath, source, privileged)
pod.Spec.Containers[0].Args = []string{
fmt.Sprintf("--new_file_0644=%v", filePath),
@ -97,7 +99,10 @@ var _ = Describe("[sig-storage] HostPath", func() {
source := &v1.HostPathVolumeSource{
Path: "/tmp",
}
pod := testPodWithHostVol(volumePath, source, true)
// we can't spawn privileged containers on Windows, nor do we need to.
privileged := !framework.NodeOSDistroIs("windows")
pod := testPodWithHostVol(volumePath, source, privileged)
// Write the file in the subPath from container 0
container := &pod.Spec.Containers[0]