Merge pull request #47236 from dixudx/not_allow_backsteps_in_local_volume

Automatic merge from submit-queue (batch tested with PRs 34515, 47236, 46694, 47819, 47792)

not allow backsteps in local volume plugin

**Which issue this PR fixes** : fixes #47207

**Special notes for your reviewer**:
cc @msau42 @ddysher
Just follow @liggitt [commented](https://github.com/kubernetes/kubernetes/issues/47107#issuecomment-306831175).

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue
2017-06-21 13:30:09 -07:00
committed by GitHub
5 changed files with 50 additions and 8 deletions

View File

@@ -281,6 +281,21 @@ func TestValidatePersistentVolumes(t *testing.T) {
StorageClassName: "backstep-hostpath",
}),
},
"bad-local-volume-backsteps": {
isExpectedFailure: true,
volume: testVolume("foo", "", api.PersistentVolumeSpec{
Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
},
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{
Local: &api.LocalVolumeSource{
Path: "/foo/..",
},
},
StorageClassName: "backstep-local",
}),
},
}
for name, scenario := range scenarios {