mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 03:38:15 +00:00
Support volume relabling for pods which specify an SELinux label
This commit is contained in:
@@ -510,6 +510,26 @@ func (f *stubVolume) GetPath() string {
|
||||
return f.path
|
||||
}
|
||||
|
||||
func (f *stubVolume) IsReadOnly() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (f *stubVolume) SetUp() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *stubVolume) SetUpAt(dir string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *stubVolume) SupportsSELinux() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (f *stubVolume) SupportsOwnershipManagement() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func TestMakeVolumeMounts(t *testing.T) {
|
||||
container := api.Container{
|
||||
VolumeMounts: []api.VolumeMount{
|
||||
@@ -537,9 +557,9 @@ func TestMakeVolumeMounts(t *testing.T) {
|
||||
}
|
||||
|
||||
podVolumes := kubecontainer.VolumeMap{
|
||||
"disk": &stubVolume{"/mnt/disk"},
|
||||
"disk4": &stubVolume{"/mnt/host"},
|
||||
"disk5": &stubVolume{"/var/lib/kubelet/podID/volumes/empty/disk5"},
|
||||
"disk": kubecontainer.VolumeInfo{Builder: &stubVolume{"/mnt/disk"}},
|
||||
"disk4": kubecontainer.VolumeInfo{Builder: &stubVolume{"/mnt/host"}},
|
||||
"disk5": kubecontainer.VolumeInfo{Builder: &stubVolume{"/var/lib/kubelet/podID/volumes/empty/disk5"}},
|
||||
}
|
||||
|
||||
pod := api.Pod{
|
||||
@@ -558,24 +578,28 @@ func TestMakeVolumeMounts(t *testing.T) {
|
||||
"/etc/hosts",
|
||||
"/mnt/disk",
|
||||
false,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"disk",
|
||||
"/mnt/path3",
|
||||
"/mnt/disk",
|
||||
true,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"disk4",
|
||||
"/mnt/path4",
|
||||
"/mnt/host",
|
||||
false,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"disk5",
|
||||
"/mnt/path5",
|
||||
"/var/lib/kubelet/podID/volumes/empty/disk5",
|
||||
false,
|
||||
false,
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(mounts, expectedMounts) {
|
||||
|
||||
Reference in New Issue
Block a user