Refactored Volume plugins to use InternalVolume instead of API types
This commit is contained in:
@@ -47,11 +47,8 @@ func (plugin *hostPathPlugin) Name() string {
|
||||
return hostPathPluginName
|
||||
}
|
||||
|
||||
func (plugin *hostPathPlugin) CanSupport(spec *api.Volume) bool {
|
||||
if spec.HostPath != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
func (plugin *hostPathPlugin) CanSupport(spec *volume.Spec) bool {
|
||||
return spec.VolumeSource.HostPath != nil || spec.PersistentVolumeSource.HostPath != nil
|
||||
}
|
||||
|
||||
func (plugin *hostPathPlugin) GetAccessModes() []api.AccessModeType {
|
||||
@@ -60,8 +57,12 @@ func (plugin *hostPathPlugin) GetAccessModes() []api.AccessModeType {
|
||||
}
|
||||
}
|
||||
|
||||
func (plugin *hostPathPlugin) NewBuilder(spec *api.Volume, podRef *api.ObjectReference, _ volume.VolumeOptions) (volume.Builder, error) {
|
||||
return &hostPath{spec.HostPath.Path}, nil
|
||||
func (plugin *hostPathPlugin) NewBuilder(spec *volume.Spec, podRef *api.ObjectReference, _ volume.VolumeOptions) (volume.Builder, error) {
|
||||
if spec.VolumeSource.HostPath != nil {
|
||||
return &hostPath{spec.VolumeSource.HostPath.Path}, nil
|
||||
} else {
|
||||
return &hostPath{spec.PersistentVolumeSource.HostPath.Path}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (plugin *hostPathPlugin) NewCleaner(volName string, podUID types.UID) (volume.Cleaner, error) {
|
||||
|
Reference in New Issue
Block a user