diff --git a/pkg/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go index 0c19e963b03..073518fd573 100644 --- a/pkg/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -52,7 +52,7 @@ func (plugin *nfsPlugin) Name() string { } func (plugin *nfsPlugin) CanSupport(spec *volume.Spec) bool { - return spec.VolumeSource.NFS != nil + return spec.VolumeSource.NFS != nil || spec.PersistentVolumeSource.NFS != nil } func (plugin *nfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { diff --git a/pkg/volume/nfs/nfs_test.go b/pkg/volume/nfs/nfs_test.go index 1c66455eb28..137a9857824 100644 --- a/pkg/volume/nfs/nfs_test.go +++ b/pkg/volume/nfs/nfs_test.go @@ -39,6 +39,9 @@ func TestCanSupport(t *testing.T) { if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{NFS: &api.NFSVolumeSource{}}}) { t.Errorf("Expected true") } + if !plug.CanSupport(&volume.Spec{Name: "foo", PersistentVolumeSource: api.PersistentVolumeSource{NFS: &api.NFSVolumeSource{}}}) { + t.Errorf("Expected true") + } if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) { t.Errorf("Expected false") }