mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Rename UniqueDeviceName to UniqueVolumeName
Rename UniqueDeviceName to UniqueVolumeName and move helper functions from attacherdetacher to volumehelper package. Introduce UniquePodName alias
This commit is contained in:
@@ -50,10 +50,19 @@ func (plugin *configMapPlugin) Init(host volume.VolumeHost) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (plugin *configMapPlugin) Name() string {
|
||||
func (plugin *configMapPlugin) GetPluginName() string {
|
||||
return configMapPluginName
|
||||
}
|
||||
|
||||
func (plugin *configMapPlugin) GetVolumeName(spec *volume.Spec) (string, error) {
|
||||
volumeSource, _ := getVolumeSource(spec)
|
||||
if volumeSource == nil {
|
||||
return "", fmt.Errorf("Spec does not reference a ConfigMap volume type")
|
||||
}
|
||||
|
||||
return volumeSource.Name, nil
|
||||
}
|
||||
|
||||
func (plugin *configMapPlugin) CanSupport(spec *volume.Spec) bool {
|
||||
return spec.Volume != nil && spec.Volume.ConfigMap != nil
|
||||
}
|
||||
@@ -226,3 +235,15 @@ func (c *configMapVolumeUnmounter) TearDownAt(dir string) error {
|
||||
}
|
||||
return wrapped.TearDownAt(dir)
|
||||
}
|
||||
|
||||
func getVolumeSource(spec *volume.Spec) (*api.ConfigMapVolumeSource, bool) {
|
||||
var readOnly bool
|
||||
var volumeSource *api.ConfigMapVolumeSource
|
||||
|
||||
if spec.Volume != nil && spec.Volume.ConfigMap != nil {
|
||||
volumeSource = spec.Volume.ConfigMap
|
||||
readOnly = spec.ReadOnly
|
||||
}
|
||||
|
||||
return volumeSource, readOnly
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user