Skip to content
Snippets Groups Projects
Commit fb27d148 authored by Arie Peterson's avatar Arie Peterson Committed by Sheng Yang
Browse files

Create local volumes instead of hostPath

parent 7322467a
Branches
Tags
No related merge requests found
...@@ -198,7 +198,6 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v ...@@ -198,7 +198,6 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
} }
fs := v1.PersistentVolumeFilesystem fs := v1.PersistentVolumeFilesystem
hostPathType := v1.HostPathDirectoryOrCreate
return &v1.PersistentVolume{ return &v1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
...@@ -211,9 +210,8 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v ...@@ -211,9 +210,8 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
v1.ResourceName(v1.ResourceStorage): pvc.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)], v1.ResourceName(v1.ResourceStorage): pvc.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)],
}, },
PersistentVolumeSource: v1.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
HostPath: &v1.HostPathVolumeSource{ Local: &v1.LocalVolumeSource{
Path: path, Path: path,
Type: &hostPathType,
}, },
}, },
NodeAffinity: &v1.VolumeNodeAffinity{ NodeAffinity: &v1.VolumeNodeAffinity{
...@@ -263,11 +261,11 @@ func (p *LocalPathProvisioner) getPathAndNodeForPV(pv *v1.PersistentVolume) (pat ...@@ -263,11 +261,11 @@ func (p *LocalPathProvisioner) getPathAndNodeForPV(pv *v1.PersistentVolume) (pat
err = errors.Wrapf(err, "failed to delete volume %v", pv.Name) err = errors.Wrapf(err, "failed to delete volume %v", pv.Name)
}() }()
hostPath := pv.Spec.PersistentVolumeSource.HostPath local := pv.Spec.PersistentVolumeSource.Local
if hostPath == nil { if local == nil {
return "", "", fmt.Errorf("no HostPath set") return "", "", fmt.Errorf("no Local set")
} }
path = hostPath.Path path = local.Path
nodeAffinity := pv.Spec.NodeAffinity nodeAffinity := pv.Spec.NodeAffinity
if nodeAffinity == nil { if nodeAffinity == nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment