Skip to content

Commit

Permalink
revert pvc directory
Browse files Browse the repository at this point in the history
  • Loading branch information
11janci committed Oct 16, 2019
1 parent 8b0cb3e commit b8492bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
11 changes: 2 additions & 9 deletions cmd/storage-provisioner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,23 @@ limitations under the License.
package main

import (
"flag"
"fmt"
"os"

"github.com/golang/glog"
"k8s.io/minikube/pkg/storage"
)

const defaultPvDir = "/pvc"

const pvDirParam = "pv-dir"

func main() {
// Glog requires that /tmp exists.
if err := os.MkdirAll("/tmp", 0755); err != nil {
fmt.Fprintf(os.Stderr, "Error creating tmpdir: %v\n", err)
os.Exit(1)
}

var pvDir = flag.String(pvDirParam, defaultPvDir, "Directory for dynamically provisioned persistent volumes")

flag.Parse()
var pvDir = "/tmp/hostpath-provisioner"

if err := storage.StartStorageProvisioner(*pvDir); err != nil {
if err := storage.StartStorageProvisioner(pvDir); err != nil {
glog.Exit(err)
}

Expand Down
6 changes: 3 additions & 3 deletions deploy/iso/minikube-iso/package/automount/minikube-automount
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ if [ -n "$BOOT2DOCKER_DATA" ]; then
mkdir /tmp/hostpath_pv
mount --bind /mnt/$PARTNAME/hostpath_pv /tmp/hostpath_pv

mkdir -p /mnt/$PARTNAME/pvc
mkdir /pvc
mount --bind /mnt/$PARTNAME/pvc /pvc
mkdir -p /mnt/$PARTNAME/hostpath-provisioner
mkdir /tmp/hostpath-provisioner
mount --bind /mnt/$PARTNAME/hostpath-provisioner /tmp/hostpath-provisioner

if [ -e "/userdata.tar" ]; then
mv /userdata.tar /var/lib/boot2docker/
Expand Down
5 changes: 2 additions & 3 deletions pkg/storage/storage_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var _ controller.Provisioner = &hostPathProvisioner{}
// Provision creates a storage asset and returns a PV object representing it.
func (p *hostPathProvisioner) Provision(options controller.ProvisionOptions) (*core.PersistentVolume, error) {
glog.Infof("Provisioning volume %v", options)
path := path.Join(p.pvDir, options.PVName)
path := path.Join(p.pvDir, options.PVC.Name)
if err := os.MkdirAll(path, 0777); err != nil {
return nil, err
}
Expand Down Expand Up @@ -103,8 +103,7 @@ func (p *hostPathProvisioner) Delete(volume *core.PersistentVolume) error {
return &controller.IgnoredError{Reason: "identity annotation on PV does not match ours"}
}

path := path.Join(p.pvDir, volume.Name)
if err := os.RemoveAll(path); err != nil {
if err := os.RemoveAll(volume.Spec.PersistentVolumeSource.HostPath.Path); err != nil {
return errors.Wrap(err, "removing hostpath PV")
}

Expand Down

0 comments on commit b8492bf

Please sign in to comment.