mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #11987 from markturansky/recyc_fix
Fixed newRecycler func for HostPath & NFS
This commit is contained in:
		@@ -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 {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user