mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Add private mount propagation to API.
And make it default
This commit is contained in:
@@ -1140,7 +1140,7 @@ func validateMountPropagation(mountPropagation *core.MountPropagationMode, conta
|
||||
return allErrs
|
||||
}
|
||||
|
||||
supportedMountPropagations := sets.NewString(string(core.MountPropagationBidirectional), string(core.MountPropagationHostToContainer))
|
||||
supportedMountPropagations := sets.NewString(string(core.MountPropagationBidirectional), string(core.MountPropagationHostToContainer), string(core.MountPropagationNone))
|
||||
if !supportedMountPropagations.Has(string(*mountPropagation)) {
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath, *mountPropagation, supportedMountPropagations.List()))
|
||||
}
|
||||
|
||||
@@ -4704,6 +4704,7 @@ func TestValidateMountPropagation(t *testing.T) {
|
||||
|
||||
propagationBidirectional := core.MountPropagationBidirectional
|
||||
propagationHostToContainer := core.MountPropagationHostToContainer
|
||||
propagationNone := core.MountPropagationNone
|
||||
propagationInvalid := core.MountPropagationMode("invalid")
|
||||
|
||||
tests := []struct {
|
||||
@@ -4723,6 +4724,12 @@ func TestValidateMountPropagation(t *testing.T) {
|
||||
defaultContainer,
|
||||
false,
|
||||
},
|
||||
{
|
||||
// non-privileged container + None
|
||||
core.VolumeMount{Name: "foo", MountPath: "/foo", MountPropagation: &propagationNone},
|
||||
defaultContainer,
|
||||
false,
|
||||
},
|
||||
{
|
||||
// error: implicitly non-privileged container + Bidirectional
|
||||
core.VolumeMount{Name: "foo", MountPath: "/foo", MountPropagation: &propagationBidirectional},
|
||||
|
||||
Reference in New Issue
Block a user