chore: make csi getPodInfoAttrs func private

This commit is contained in:
phantooom 2021-04-15 20:51:51 +08:00
parent 0017b602be
commit 82c2266f25
3 changed files with 4 additions and 4 deletions

View File

@ -222,7 +222,7 @@ func (m *csiBlockMapper) publishVolumeForBlock(
return "", errors.New(log("blockMapper.publishVolumeForBlock failed to get VolumeLifecycleMode: %v", err)) return "", errors.New(log("blockMapper.publishVolumeForBlock failed to get VolumeLifecycleMode: %v", err))
} }
if podInfoEnabled { if podInfoEnabled {
volAttribs = mergeMap(volAttribs, GetPodInfoAttrs(m.pod, volumeLifecycleMode)) volAttribs = mergeMap(volAttribs, getPodInfoAttrs(m.pod, volumeLifecycleMode))
} }
nodePublishSecrets := map[string]string{} nodePublishSecrets := map[string]string{}

View File

@ -225,7 +225,7 @@ func (c *csiMountMgr) SetUpAt(dir string, mounterArgs volume.MounterArgs) error
return volumetypes.NewTransientOperationFailure(log("mounter.SetUpAt failed to assemble volume attributes: %v", err)) return volumetypes.NewTransientOperationFailure(log("mounter.SetUpAt failed to assemble volume attributes: %v", err))
} }
if podInfoEnabled { if podInfoEnabled {
volAttribs = mergeMap(volAttribs, GetPodInfoAttrs(c.pod, c.volumeLifecycleMode)) volAttribs = mergeMap(volAttribs, getPodInfoAttrs(c.pod, c.volumeLifecycleMode))
} }
// Inject pod service account token into volume attributes // Inject pod service account token into volume attributes

View File

@ -205,8 +205,8 @@ func createCSIOperationContext(volumeSpec *volume.Spec, timeout time.Duration) (
return context.WithTimeout(ctx, timeout) return context.WithTimeout(ctx, timeout)
} }
// GetPodInfoAttrs returns pod info for NodePublish // getPodInfoAttrs returns pod info for NodePublish
func GetPodInfoAttrs(pod *api.Pod, volumeMode storage.VolumeLifecycleMode) map[string]string { func getPodInfoAttrs(pod *api.Pod, volumeMode storage.VolumeLifecycleMode) map[string]string {
attrs := map[string]string{ attrs := map[string]string{
"csi.storage.k8s.io/pod.name": pod.Name, "csi.storage.k8s.io/pod.name": pod.Name,
"csi.storage.k8s.io/pod.namespace": pod.Namespace, "csi.storage.k8s.io/pod.namespace": pod.Namespace,