Merge pull request #31146 from pmorie/recycle-hostpath-slash
Automatic merge from submit-queue Add validation preventing recycle of / in a hostPath PV Adds a validation that prevents a user from recycling `/` when it is used in a hostPath PV cc @kubernetes/sig-storage
This commit is contained in:
@@ -549,6 +549,32 @@ func TestValidatePersistentVolumes(t *testing.T) {
|
||||
},
|
||||
}),
|
||||
},
|
||||
"host mount of / with recycle reclaim policy": {
|
||||
isExpectedFailure: true,
|
||||
volume: testVolume("bad-recycle-do-not-want", "", api.PersistentVolumeSpec{
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
|
||||
},
|
||||
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
|
||||
PersistentVolumeSource: api.PersistentVolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: "/"},
|
||||
},
|
||||
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimRecycle,
|
||||
}),
|
||||
},
|
||||
"host mount of / with recycle reclaim policy 2": {
|
||||
isExpectedFailure: true,
|
||||
volume: testVolume("bad-recycle-do-not-want", "", api.PersistentVolumeSpec{
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
|
||||
},
|
||||
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
|
||||
PersistentVolumeSource: api.PersistentVolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: "/a/.."},
|
||||
},
|
||||
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimRecycle,
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
for name, scenario := range scenarios {
|
||||
|
Reference in New Issue
Block a user