Refactor ConstructVolumeSpec

Return a struct from ConstructVolumeSpec to be able to add more fields to
it later.
This commit is contained in:
Jan Safranek
2022-10-19 14:52:08 +02:00
parent 2dc8cc13a4
commit fc245b339b
35 changed files with 202 additions and 141 deletions

View File

@@ -123,14 +123,16 @@ func (plugin *gitRepoPlugin) NewUnmounter(volName string, podUID types.UID) (vol
}, nil
}
func (plugin *gitRepoPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
func (plugin *gitRepoPlugin) ConstructVolumeSpec(volumeName, mountPath string) (volume.ReconstructedVolume, error) {
gitVolume := &v1.Volume{
Name: volumeName,
VolumeSource: v1.VolumeSource{
GitRepo: &v1.GitRepoVolumeSource{},
},
}
return volume.NewSpecFromVolume(gitVolume), nil
return volume.ReconstructedVolume{
Spec: volume.NewSpecFromVolume(gitVolume),
}, nil
}
// gitRepo volumes are directories which are pre-filled from a git repository.