Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create local volumes instead of hostPath #91

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
}

fs := v1.PersistentVolumeFilesystem
hostPathType := v1.HostPathDirectoryOrCreate
return &v1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand All @@ -212,9 +211,8 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
v1.ResourceName(v1.ResourceStorage): pvc.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)],
},
PersistentVolumeSource: v1.PersistentVolumeSource{
HostPath: &v1.HostPathVolumeSource{
Local: &v1.LocalVolumeSource{
Path: path,
Type: &hostPathType,
},
},
NodeAffinity: &v1.VolumeNodeAffinity{
Expand Down Expand Up @@ -264,11 +262,11 @@ func (p *LocalPathProvisioner) getPathAndNodeForPV(pv *v1.PersistentVolume) (pat
err = errors.Wrapf(err, "failed to delete volume %v", pv.Name)
}()

hostPath := pv.Spec.PersistentVolumeSource.HostPath
if hostPath == nil {
return "", "", fmt.Errorf("no HostPath set")
local := pv.Spec.PersistentVolumeSource.Local
if local == nil {
return "", "", fmt.Errorf("no Local set")
}
path = hostPath.Path
path = local.Path

nodeAffinity := pv.Spec.NodeAffinity
if nodeAffinity == nil {
Expand Down