From df53c25a38ffa7122ab8a3f34f1af7eec420b721 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@rancher.com>
Date: Mon, 10 Aug 2020 12:23:03 -0700
Subject: [PATCH] Revert "Create local volumes instead of hostPath"

This reverts commit fb27d148945651f4d0c6117153d740beaefe6e00.

Local volumes breaks provisioner on RKE.

Revert: https://github.com/rancher/local-path-provisioner/pull/91
---
 provisioner.go | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/provisioner.go b/provisioner.go
index e80e8cc8..6c2260f5 100644
--- a/provisioner.go
+++ b/provisioner.go
@@ -198,6 +198,7 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
 	}
 
 	fs := v1.PersistentVolumeFilesystem
+	hostPathType := v1.HostPathDirectoryOrCreate
 	return &v1.PersistentVolume{
 		ObjectMeta: metav1.ObjectMeta{
 			Name: name,
@@ -210,8 +211,9 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
 				v1.ResourceName(v1.ResourceStorage): pvc.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)],
 			},
 			PersistentVolumeSource: v1.PersistentVolumeSource{
-				Local: &v1.LocalVolumeSource{
+				HostPath: &v1.HostPathVolumeSource{
 					Path: path,
+					Type: &hostPathType,
 				},
 			},
 			NodeAffinity: &v1.VolumeNodeAffinity{
@@ -261,11 +263,11 @@ func (p *LocalPathProvisioner) getPathAndNodeForPV(pv *v1.PersistentVolume) (pat
 		err = errors.Wrapf(err, "failed to delete volume %v", pv.Name)
 	}()
 
-	local := pv.Spec.PersistentVolumeSource.Local
-	if local == nil {
-		return "", "", fmt.Errorf("no Local set")
+	hostPath := pv.Spec.PersistentVolumeSource.HostPath
+	if hostPath == nil {
+		return "", "", fmt.Errorf("no HostPath set")
 	}
-	path = local.Path
+	path = hostPath.Path
 
 	nodeAffinity := pv.Spec.NodeAffinity
 	if nodeAffinity == nil {
-- 
GitLab