Commit f40b970b authored by Mike Danese's avatar Mike Danese

Merge pull request #11987 from markturansky/recyc_fix

Fixed newRecycler func for HostPath & NFS
parents 72db883b 649374dd
...@@ -86,11 +86,10 @@ func (plugin *hostPathPlugin) NewRecycler(spec *volume.Spec) (volume.Recycler, e ...@@ -86,11 +86,10 @@ func (plugin *hostPathPlugin) NewRecycler(spec *volume.Spec) (volume.Recycler, e
} }
func newRecycler(spec *volume.Spec, host volume.VolumeHost) (volume.Recycler, error) { func newRecycler(spec *volume.Spec, host volume.VolumeHost) (volume.Recycler, error) {
if spec.VolumeSource.HostPath != nil { if spec.PersistentVolumeSource.HostPath == nil {
return &hostPathRecycler{spec.Name, spec.VolumeSource.HostPath.Path, host}, nil return nil, fmt.Errorf("spec.PersistentVolumeSource.HostPath is nil")
} else {
return &hostPathRecycler{spec.Name, spec.PersistentVolumeSource.HostPath.Path, host}, nil
} }
return &hostPathRecycler{spec.Name, spec.PersistentVolumeSource.HostPath.Path, host}, nil
} }
// HostPath volumes represent a bare host file or directory mount. // HostPath volumes represent a bare host file or directory mount.
......
...@@ -223,21 +223,15 @@ func (c *nfsCleaner) TearDownAt(dir string) error { ...@@ -223,21 +223,15 @@ func (c *nfsCleaner) TearDownAt(dir string) error {
} }
func newRecycler(spec *volume.Spec, host volume.VolumeHost) (volume.Recycler, error) { func newRecycler(spec *volume.Spec, host volume.VolumeHost) (volume.Recycler, error) {
if spec.VolumeSource.HostPath != nil { if spec.PersistentVolumeSource.NFS == nil {
return &nfsRecycler{ return nil, fmt.Errorf("spec.PersistentVolumeSource.NFS is nil")
name: spec.Name,
server: spec.VolumeSource.NFS.Server,
path: spec.VolumeSource.NFS.Path,
host: host,
}, nil
} else {
return &nfsRecycler{
name: spec.Name,
server: spec.PersistentVolumeSource.NFS.Server,
path: spec.PersistentVolumeSource.NFS.Path,
host: host,
}, nil
} }
return &nfsRecycler{
name: spec.Name,
server: spec.PersistentVolumeSource.NFS.Server,
path: spec.PersistentVolumeSource.NFS.Path,
host: host,
}, nil
} }
// nfsRecycler scrubs an NFS volume by running "rm -rf" on the volume in a pod. // nfsRecycler scrubs an NFS volume by running "rm -rf" on the volume in a pod.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment