implement proposal 34058: hostPath volume type

This commit is contained in:
Di Xu
2017-06-07 13:10:09 +08:00
parent 625eb9ab7a
commit 5c45db564f
14 changed files with 753 additions and 22 deletions

View File

@@ -46,6 +46,12 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer)
return persistentVolumeStorage, statusStorage, server
}
func newHostPathType(pathType string) *api.HostPathType {
hostPathType := new(api.HostPathType)
*hostPathType = api.HostPathType(pathType)
return hostPathType
}
func validNewPersistentVolume(name string) *api.PersistentVolume {
pv := &api.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
@@ -57,7 +63,7 @@ func validNewPersistentVolume(name string) *api.PersistentVolume {
},
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "/foo"},
HostPath: &api.HostPathVolumeSource{Path: "/foo", Type: newHostPathType(string(api.HostPathDirectoryOrCreate))},
},
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimRetain,
},