mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
rename Gid => GID
according to stylecheck
This commit is contained in:
parent
ce81cc70a6
commit
f9a9b6f660
@ -370,8 +370,8 @@ type mountedPod struct {
|
||||
// call for volumes that do not need to update contents should not fail.
|
||||
remountRequired bool
|
||||
|
||||
// volumeGidValue contains the value of the GID annotation, if present.
|
||||
volumeGidValue string
|
||||
// volumeGIDValue contains the value of the GID annotation, if present.
|
||||
volumeGIDValue string
|
||||
|
||||
// volumeMountStateForPod stores state of volume mount for the pod. if it is:
|
||||
// - VolumeMounted: means volume for pod has been successfully mounted
|
||||
@ -484,7 +484,7 @@ func (asw *actualStateOfWorld) CheckAndMarkVolumeAsUncertainViaReconstruction(op
|
||||
mounter := opts.Mounter
|
||||
blockVolumeMapper := opts.BlockVolumeMapper
|
||||
outerVolumeSpecName := opts.OuterVolumeSpecName
|
||||
volumeGidValue := opts.VolumeGidVolume
|
||||
volumeGIDValue := opts.VolumeGIDVolume
|
||||
volumeSpec := opts.VolumeSpec
|
||||
|
||||
podObj = mountedPod{
|
||||
@ -493,7 +493,7 @@ func (asw *actualStateOfWorld) CheckAndMarkVolumeAsUncertainViaReconstruction(op
|
||||
mounter: mounter,
|
||||
blockVolumeMapper: blockVolumeMapper,
|
||||
outerVolumeSpecName: outerVolumeSpecName,
|
||||
volumeGidValue: volumeGidValue,
|
||||
volumeGIDValue: volumeGIDValue,
|
||||
volumeSpec: volumeSpec,
|
||||
remountRequired: false,
|
||||
volumeMountStateForPod: operationexecutor.VolumeMountUncertain,
|
||||
@ -731,7 +731,7 @@ func (asw *actualStateOfWorld) AddPodToVolume(markVolumeOpts operationexecutor.M
|
||||
mounter := markVolumeOpts.Mounter
|
||||
blockVolumeMapper := markVolumeOpts.BlockVolumeMapper
|
||||
outerVolumeSpecName := markVolumeOpts.OuterVolumeSpecName
|
||||
volumeGidValue := markVolumeOpts.VolumeGidVolume
|
||||
volumeGIDValue := markVolumeOpts.VolumeGIDVolume
|
||||
volumeSpec := markVolumeOpts.VolumeSpec
|
||||
asw.Lock()
|
||||
defer asw.Unlock()
|
||||
@ -760,7 +760,7 @@ func (asw *actualStateOfWorld) AddPodToVolume(markVolumeOpts operationexecutor.M
|
||||
mounter: mounter,
|
||||
blockVolumeMapper: blockVolumeMapper,
|
||||
outerVolumeSpecName: outerVolumeSpecName,
|
||||
volumeGidValue: volumeGidValue,
|
||||
volumeGIDValue: volumeGIDValue,
|
||||
volumeSpec: volumeSpec,
|
||||
volumeMountStateForPod: markVolumeOpts.VolumeMountState,
|
||||
seLinuxMountContext: markVolumeOpts.SELinuxMountContext,
|
||||
@ -1311,7 +1311,7 @@ func getMountedVolume(
|
||||
PodUID: mountedPod.podUID,
|
||||
Mounter: mountedPod.mounter,
|
||||
BlockVolumeMapper: mountedPod.blockVolumeMapper,
|
||||
VolumeGidValue: mountedPod.volumeGidValue,
|
||||
VolumeGIDValue: mountedPod.volumeGIDValue,
|
||||
VolumeSpec: mountedPod.volumeSpec,
|
||||
DeviceMountPath: attachedVolume.deviceMountPath,
|
||||
SELinuxMountContext: seLinuxMountContext}}
|
||||
|
@ -61,7 +61,7 @@ type DesiredStateOfWorld interface {
|
||||
// added.
|
||||
// If a pod with the same unique name already exists under the specified
|
||||
// volume, this is a no-op.
|
||||
AddPodToVolume(podName types.UniquePodName, pod *v1.Pod, volumeSpec *volume.Spec, outerVolumeSpecName string, volumeGidValue string, seLinuxContainerContexts []*v1.SELinuxOptions) (v1.UniqueVolumeName, error)
|
||||
AddPodToVolume(podName types.UniquePodName, pod *v1.Pod, volumeSpec *volume.Spec, outerVolumeSpecName string, volumeGIDValue string, seLinuxContainerContexts []*v1.SELinuxOptions) (v1.UniqueVolumeName, error)
|
||||
|
||||
// MarkVolumesReportedInUse sets the ReportedInUse value to true for the
|
||||
// reportedVolumes. For volumes not in the reportedVolumes list, the
|
||||
@ -193,8 +193,8 @@ type volumeToMount struct {
|
||||
// the volume.DeviceMounter interface
|
||||
pluginIsDeviceMountable bool
|
||||
|
||||
// volumeGidValue contains the value of the GID annotation, if present.
|
||||
volumeGidValue string
|
||||
// volumeGIDValue contains the value of the GID annotation, if present.
|
||||
volumeGIDValue string
|
||||
|
||||
// reportedInUse indicates that the volume was successfully added to the
|
||||
// VolumesInUse field in the node's status.
|
||||
@ -262,7 +262,7 @@ func (dsw *desiredStateOfWorld) AddPodToVolume(
|
||||
pod *v1.Pod,
|
||||
volumeSpec *volume.Spec,
|
||||
outerVolumeSpecName string,
|
||||
volumeGidValue string,
|
||||
volumeGIDValue string,
|
||||
seLinuxContainerContexts []*v1.SELinuxOptions) (v1.UniqueVolumeName, error) {
|
||||
dsw.Lock()
|
||||
defer dsw.Unlock()
|
||||
@ -336,7 +336,7 @@ func (dsw *desiredStateOfWorld) AddPodToVolume(
|
||||
podsToMount: make(map[types.UniquePodName]podToMount),
|
||||
pluginIsAttachable: attachable,
|
||||
pluginIsDeviceMountable: deviceMountable,
|
||||
volumeGidValue: volumeGidValue,
|
||||
volumeGIDValue: volumeGIDValue,
|
||||
reportedInUse: false,
|
||||
desiredSizeLimit: sizeLimit,
|
||||
effectiveSELinuxMountFileLabel: effectiveSELinuxMountLabel,
|
||||
@ -606,7 +606,7 @@ func (dsw *desiredStateOfWorld) GetVolumesToMount() []VolumeToMount {
|
||||
PluginIsAttachable: volumeObj.pluginIsAttachable,
|
||||
PluginIsDeviceMountable: volumeObj.pluginIsDeviceMountable,
|
||||
OuterVolumeSpecName: podObj.outerVolumeSpecName,
|
||||
VolumeGidValue: volumeObj.volumeGidValue,
|
||||
VolumeGIDValue: volumeObj.volumeGIDValue,
|
||||
ReportedInUse: volumeObj.reportedInUse,
|
||||
MountRequestTime: podObj.mountRequestTime,
|
||||
DesiredSizeLimit: volumeObj.desiredSizeLimit,
|
||||
|
@ -65,7 +65,7 @@ func Test_AddPodToVolume_Positive_NewPodNewVolume(t *testing.T) {
|
||||
|
||||
// Act
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxContainerContexts */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxContainerContexts */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -111,7 +111,7 @@ func Test_AddPodToVolume_Positive_ExistingPodExistingVolume(t *testing.T) {
|
||||
|
||||
// Act
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxContainerContexts */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxContainerContexts */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -318,7 +318,7 @@ func Test_DeletePodFromVolume_Positive_PodExistsVolumeExists(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxContainerContexts */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxContainerContexts */)
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
}
|
||||
@ -417,19 +417,19 @@ func Test_MarkVolumesReportedInUse_Positive_NewPodNewVolume(t *testing.T) {
|
||||
pod3Name := util.GetUniquePodName(pod3)
|
||||
|
||||
generatedVolume1Name, err := dsw.AddPodToVolume(
|
||||
pod1Name, pod1, volume1Spec, volume1Spec.Name(), "" /* volumeGidValue */, nil /* seLinuxContainerContexts */)
|
||||
pod1Name, pod1, volume1Spec, volume1Spec.Name(), "" /* volumeGIDValue */, nil /* seLinuxContainerContexts */)
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
}
|
||||
|
||||
generatedVolume2Name, err := dsw.AddPodToVolume(
|
||||
pod2Name, pod2, volume2Spec, volume2Spec.Name(), "" /* volumeGidValue */, nil /* seLinuxContainerContexts */)
|
||||
pod2Name, pod2, volume2Spec, volume2Spec.Name(), "" /* volumeGIDValue */, nil /* seLinuxContainerContexts */)
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
}
|
||||
|
||||
generatedVolume3Name, err := dsw.AddPodToVolume(
|
||||
pod3Name, pod3, volume3Spec, volume3Spec.Name(), "" /* volumeGidValue */, nil /* seLinuxContainerContexts */)
|
||||
pod3Name, pod3, volume3Spec, volume3Spec.Name(), "" /* volumeGIDValue */, nil /* seLinuxContainerContexts */)
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
}
|
||||
@ -865,7 +865,7 @@ func Test_AddPodToVolume_SELinuxSinglePod(t *testing.T) {
|
||||
|
||||
// Act
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, seLinuxContainerContexts)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, seLinuxContainerContexts)
|
||||
|
||||
// Assert
|
||||
if tc.expectError {
|
||||
@ -1214,7 +1214,7 @@ func Test_AddPodToVolume_SELinux_MultiplePods(t *testing.T) {
|
||||
|
||||
// Act
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, seLinuxContainerContexts)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, seLinuxContainerContexts)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -1238,7 +1238,7 @@ func Test_AddPodToVolume_SELinux_MultiplePods(t *testing.T) {
|
||||
|
||||
// Act
|
||||
generatedVolumeName2, err := dsw.AddPodToVolume(
|
||||
pod2Name, pod2, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, seLinuxContainerContexts)
|
||||
pod2Name, pod2, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, seLinuxContainerContexts)
|
||||
// Assert
|
||||
if tc.expectError {
|
||||
if err == nil {
|
||||
|
@ -312,7 +312,7 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes(
|
||||
continue
|
||||
}
|
||||
|
||||
pvc, volumeSpec, volumeGidValue, err :=
|
||||
pvc, volumeSpec, volumeGIDValue, err :=
|
||||
dswp.createVolumeSpec(logger, podVolume, pod, mounts, devices)
|
||||
if err != nil {
|
||||
logger.Error(err, "Error processing volume", "pod", klog.KObj(pod), "volumeName", podVolume.Name)
|
||||
@ -323,7 +323,7 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes(
|
||||
|
||||
// Add volume to desired state of world
|
||||
_, err = dswp.desiredStateOfWorld.AddPodToVolume(
|
||||
uniquePodName, pod, volumeSpec, podVolume.Name, volumeGidValue, seLinuxContainerContexts[podVolume.Name])
|
||||
uniquePodName, pod, volumeSpec, podVolume.Name, volumeGIDValue, seLinuxContainerContexts[podVolume.Name])
|
||||
if err != nil {
|
||||
logger.Error(err, "Failed to add volume to desiredStateOfWorld", "pod", klog.KObj(pod), "volumeName", podVolume.Name, "volumeSpecName", volumeSpec.Name())
|
||||
dswp.desiredStateOfWorld.AddErrorToPod(uniquePodName, err.Error())
|
||||
@ -494,7 +494,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
||||
pvName, pvcUID := pvc.Spec.VolumeName, pvc.UID
|
||||
logger.V(5).Info("Found bound PV for PVC", "PVC", klog.KRef(pod.Namespace, pvcSource.ClaimName), "PVCUID", pvcUID, "PVName", pvName)
|
||||
// Fetch actual PV object
|
||||
volumeSpec, volumeGidValue, err :=
|
||||
volumeSpec, volumeGIDValue, err :=
|
||||
dswp.getPVSpec(pvName, pvcSource.ReadOnly, pvcUID)
|
||||
if err != nil {
|
||||
return nil, nil, "", fmt.Errorf(
|
||||
@ -533,7 +533,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
||||
podVolume.Name,
|
||||
volumeMode)
|
||||
}
|
||||
return pvc, volumeSpec, volumeGidValue, nil
|
||||
return pvc, volumeSpec, volumeGIDValue, nil
|
||||
}
|
||||
|
||||
// Do not return the original volume object, since the source could mutate it
|
||||
@ -614,8 +614,8 @@ func (dswp *desiredStateOfWorldPopulator) getPVSpec(
|
||||
expectedClaimUID)
|
||||
}
|
||||
|
||||
volumeGidValue := getPVVolumeGidAnnotationValue(pv)
|
||||
return volume.NewSpecFromPersistentVolume(pv, pvcReadOnly), volumeGidValue, nil
|
||||
volumeGIDValue := getPVVolumeGidAnnotationValue(pv)
|
||||
return volume.NewSpecFromPersistentVolume(pv, pvcReadOnly), volumeGIDValue, nil
|
||||
}
|
||||
|
||||
func getPVVolumeGidAnnotationValue(pv *v1.PersistentVolume) string {
|
||||
|
@ -406,7 +406,7 @@ func TestFindAndRemoveDeletedPodsWithUncertain(t *testing.T) {
|
||||
PodUID: pod.UID,
|
||||
VolumeName: expectedVolumeName,
|
||||
OuterVolumeSpecName: "dswp-test-volume-name",
|
||||
VolumeGidVolume: "",
|
||||
VolumeGIDVolume: "",
|
||||
VolumeSpec: volume.NewSpecFromPersistentVolume(pv, false),
|
||||
VolumeMountState: operationexecutor.VolumeMountUncertain,
|
||||
}
|
||||
@ -1392,7 +1392,7 @@ func reconcileASW(asw cache.ActualStateOfWorld, dsw cache.DesiredStateOfWorld, t
|
||||
PodUID: volumeToMount.Pod.UID,
|
||||
VolumeName: volumeToMount.VolumeName,
|
||||
OuterVolumeSpecName: volumeToMount.OuterVolumeSpecName,
|
||||
VolumeGidVolume: volumeToMount.VolumeGidValue,
|
||||
VolumeGIDVolume: volumeToMount.VolumeGIDValue,
|
||||
VolumeSpec: volumeToMount.VolumeSpec,
|
||||
VolumeMountState: operationexecutor.VolumeMounted,
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ func Test_Run_Positive_VolumeAttachAndMount(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -269,7 +269,7 @@ func Test_Run_Positive_VolumeAttachAndMountMigrationEnabled(t *testing.T) {
|
||||
pod,
|
||||
migratedSpec,
|
||||
migratedSpec.Name(),
|
||||
"", /* volumeGidValue */
|
||||
"", /* volumeGIDValue */
|
||||
nil, /* SELinuxContexts */
|
||||
)
|
||||
|
||||
@ -361,7 +361,7 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabled(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
dsw.MarkVolumesReportedInUse([]v1.UniqueVolumeName{generatedVolumeName})
|
||||
|
||||
// Assert
|
||||
@ -441,7 +441,7 @@ func Test_Run_Negative_VolumeMountControllerAttachEnabled(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -520,7 +520,7 @@ func Test_Run_Positive_VolumeAttachMountUnmountDetach(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -623,7 +623,7 @@ func Test_Run_Positive_VolumeUnmountControllerAttachEnabled(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -731,7 +731,7 @@ func Test_Run_Positive_VolumeAttachAndMap(t *testing.T) {
|
||||
}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -844,7 +844,7 @@ func Test_Run_Positive_BlockVolumeMapControllerAttachEnabled(t *testing.T) {
|
||||
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
dsw.MarkVolumesReportedInUse([]v1.UniqueVolumeName{generatedVolumeName})
|
||||
|
||||
// Assert
|
||||
@ -942,7 +942,7 @@ func Test_Run_Positive_BlockVolumeAttachMapUnmapDetach(t *testing.T) {
|
||||
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -1067,7 +1067,7 @@ func Test_Run_Positive_VolumeUnmapControllerAttachEnabled(t *testing.T) {
|
||||
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
|
||||
// Assert
|
||||
if err != nil {
|
||||
@ -1349,7 +1349,7 @@ func Test_Run_Positive_VolumeFSResizeControllerAttachEnabled(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{PersistentVolume: pv}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
volumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
// Assert
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
@ -1370,7 +1370,7 @@ func Test_Run_Positive_VolumeFSResizeControllerAttachEnabled(t *testing.T) {
|
||||
// Simulate what DSOWP does
|
||||
pvWithSize.Spec.Capacity[v1.ResourceStorage] = tc.newPVSize
|
||||
volumeSpec = &volume.Spec{PersistentVolume: pvWithSize}
|
||||
dsw.AddPodToVolume(podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxContexts */)
|
||||
dsw.AddPodToVolume(podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxContexts */)
|
||||
|
||||
t.Logf("Changing size of the volume to %s", tc.newPVSize.String())
|
||||
newSize := tc.newPVSize.DeepCopy()
|
||||
@ -1604,7 +1604,7 @@ func Test_UncertainDeviceGlobalMounts(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{PersistentVolume: pv}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
volumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
// Assert
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
@ -1827,7 +1827,7 @@ func Test_UncertainVolumeMountState(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{PersistentVolume: pv}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
volumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
// Assert
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
@ -2166,7 +2166,7 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
|
||||
volumeSpecCopy := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
generatedVolumeName, err := dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
dsw.MarkVolumesReportedInUse([]v1.UniqueVolumeName{generatedVolumeName})
|
||||
|
||||
if err != nil {
|
||||
@ -2193,7 +2193,7 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
|
||||
klog.InfoS("UnmountDevice called")
|
||||
var generatedVolumeNameCopy v1.UniqueVolumeName
|
||||
generatedVolumeNameCopy, err = dsw.AddPodToVolume(
|
||||
podName, pod, volumeSpecCopy, volumeSpec.Name(), "" /* volumeGidValue */, nil /* seLinuxLabel */)
|
||||
podName, pod, volumeSpecCopy, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* seLinuxLabel */)
|
||||
dsw.MarkVolumesReportedInUse([]v1.UniqueVolumeName{generatedVolumeNameCopy})
|
||||
return nil
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ func (rc *reconciler) updateStates(reconstructedVolumes map[v1.UniqueVolumeName]
|
||||
Mounter: volume.mounter,
|
||||
BlockVolumeMapper: volume.blockVolumeMapper,
|
||||
OuterVolumeSpecName: volume.outerVolumeSpecName,
|
||||
VolumeGidVolume: volume.volumeGidValue,
|
||||
VolumeGIDVolume: volume.volumeGIDValue,
|
||||
VolumeSpec: volume.volumeSpec,
|
||||
VolumeMountState: operationexecutor.VolumeMountUncertain,
|
||||
SELinuxMountContext: volume.seLinuxMountContext,
|
||||
|
@ -74,7 +74,7 @@ type reconstructedVolume struct {
|
||||
volumeSpec *volumepkg.Spec
|
||||
outerVolumeSpecName string
|
||||
pod *v1.Pod
|
||||
volumeGidValue string
|
||||
volumeGIDValue string
|
||||
devicePath string
|
||||
mounter volumepkg.Mounter
|
||||
deviceMounter volumepkg.DeviceMounter
|
||||
@ -98,7 +98,7 @@ func (rv reconstructedVolume) MarshalLog() interface{} {
|
||||
VolumeSpecName: rv.volumeSpec.Name(),
|
||||
OuterVolumeSpecName: rv.outerVolumeSpecName,
|
||||
PodUID: string(rv.pod.UID),
|
||||
VolumeGIDValue: rv.volumeGidValue,
|
||||
VolumeGIDValue: rv.volumeGIDValue,
|
||||
DevicePath: rv.devicePath,
|
||||
SeLinuxMountContext: rv.seLinuxMountContext,
|
||||
}
|
||||
@ -386,7 +386,7 @@ func (rc *reconciler) reconstructVolume(volume podVolume) (rvolume *reconstructe
|
||||
outerVolumeSpecName: volume.volumeSpecName,
|
||||
pod: pod,
|
||||
deviceMounter: deviceMounter,
|
||||
volumeGidValue: "",
|
||||
volumeGIDValue: "",
|
||||
// devicePath is updated during updateStates() by checking node status's VolumesAttached data.
|
||||
// TODO: get device path directly from the volume mount path.
|
||||
devicePath: "",
|
||||
|
@ -195,7 +195,7 @@ func TestCleanOrphanVolumes(t *testing.T) {
|
||||
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
|
||||
podName := util.GetUniquePodName(pod)
|
||||
volumeName, err := rcInstance.desiredStateOfWorld.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* SELinuxContext */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* SELinuxContext */)
|
||||
if err != nil {
|
||||
t.Fatalf("Error adding volume %s to dsow: %v", volumeSpec.Name(), err)
|
||||
}
|
||||
@ -318,7 +318,7 @@ func TestReconstructVolumesMount(t *testing.T) {
|
||||
|
||||
podName := util.GetUniquePodName(pod)
|
||||
volumeName, err := rcInstance.desiredStateOfWorld.AddPodToVolume(
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */, nil /* SELinuxContext */)
|
||||
podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGIDValue */, nil /* SELinuxContext */)
|
||||
if err != nil {
|
||||
t.Fatalf("Error adding volume %s to dsow: %v", volumeSpec.Name(), err)
|
||||
}
|
||||
|
@ -334,14 +334,14 @@ func (vm *volumeManager) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64 {
|
||||
supplementalGroups := sets.New[string]()
|
||||
|
||||
for _, mountedVolume := range vm.actualStateOfWorld.GetMountedVolumesForPod(podName) {
|
||||
if mountedVolume.VolumeGidValue != "" {
|
||||
supplementalGroups.Insert(mountedVolume.VolumeGidValue)
|
||||
if mountedVolume.VolumeGIDValue != "" {
|
||||
supplementalGroups.Insert(mountedVolume.VolumeGIDValue)
|
||||
}
|
||||
}
|
||||
|
||||
result := make([]int64, 0, supplementalGroups.Len())
|
||||
for _, group := range supplementalGroups.UnsortedList() {
|
||||
iGroup, extra := getExtraSupplementalGid(group, pod)
|
||||
iGroup, extra := getExtraSupplementalGID(group, pod)
|
||||
if !extra {
|
||||
continue
|
||||
}
|
||||
@ -585,22 +585,22 @@ func getExpectedVolumes(pod *v1.Pod) []string {
|
||||
return mounts.Union(devices).UnsortedList()
|
||||
}
|
||||
|
||||
// getExtraSupplementalGid returns the value of an extra supplemental GID as
|
||||
// getExtraSupplementalGID returns the value of an extra supplemental GID as
|
||||
// defined by an annotation on a volume and a boolean indicating whether the
|
||||
// volume defined a GID that the pod doesn't already request.
|
||||
func getExtraSupplementalGid(volumeGidValue string, pod *v1.Pod) (int64, bool) {
|
||||
if volumeGidValue == "" {
|
||||
func getExtraSupplementalGID(volumeGIDValue string, pod *v1.Pod) (int64, bool) {
|
||||
if volumeGIDValue == "" {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
gid, err := strconv.ParseInt(volumeGidValue, 10, 64)
|
||||
gid, err := strconv.ParseInt(volumeGIDValue, 10, 64)
|
||||
if err != nil {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
if pod.Spec.SecurityContext != nil {
|
||||
for _, existingGid := range pod.Spec.SecurityContext.SupplementalGroups {
|
||||
if gid == int64(existingGid) {
|
||||
for _, existingGID := range pod.Spec.SecurityContext.SupplementalGroups {
|
||||
if gid == int64(existingGID) {
|
||||
return 0, false
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ type MarkVolumeOpts struct {
|
||||
Mounter volume.Mounter
|
||||
BlockVolumeMapper volume.BlockVolumeMapper
|
||||
OuterVolumeSpecName string
|
||||
VolumeGidVolume string
|
||||
VolumeGIDVolume string
|
||||
VolumeSpec *volume.Spec
|
||||
VolumeMountState VolumeMountState
|
||||
SELinuxMountContext string
|
||||
@ -438,8 +438,8 @@ type VolumeToMount struct {
|
||||
// the volume.DeviceMounter interface
|
||||
PluginIsDeviceMountable bool
|
||||
|
||||
// VolumeGidValue contains the value of the GID annotation, if present.
|
||||
VolumeGidValue string
|
||||
// VolumeGIDValue contains the value of the GID annotation, if present.
|
||||
VolumeGIDValue string
|
||||
|
||||
// DevicePath contains the path on the node where the volume is attached.
|
||||
// For non-attachable volumes this is empty.
|
||||
@ -739,8 +739,8 @@ type MountedVolume struct {
|
||||
// BlockVolumeMapper is only required for block volumes and not required for file system volumes.
|
||||
BlockVolumeMapper volume.BlockVolumeMapper
|
||||
|
||||
// VolumeGidValue contains the value of the GID annotation, if present.
|
||||
VolumeGidValue string
|
||||
// VolumeGIDValue contains the value of the GID annotation, if present.
|
||||
VolumeGIDValue string
|
||||
|
||||
// VolumeSpec is a volume spec containing the specification for the volume
|
||||
// that should be mounted.
|
||||
|
@ -616,7 +616,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
|
||||
VolumeName: volumeToMount.VolumeName,
|
||||
Mounter: volumeMounter,
|
||||
OuterVolumeSpecName: volumeToMount.OuterVolumeSpecName,
|
||||
VolumeGidVolume: volumeToMount.VolumeGidValue,
|
||||
VolumeGIDVolume: volumeToMount.VolumeGIDValue,
|
||||
VolumeSpec: volumeToMount.VolumeSpec,
|
||||
VolumeMountState: VolumeMounted,
|
||||
SELinuxMountContext: volumeToMount.SELinuxLabel,
|
||||
@ -785,7 +785,7 @@ func (og *operationGenerator) GenerateUnmountVolumeFunc(
|
||||
PodUID: volumeToUnmount.PodUID,
|
||||
VolumeName: volumeToUnmount.VolumeName,
|
||||
OuterVolumeSpecName: volumeToUnmount.OuterVolumeSpecName,
|
||||
VolumeGidVolume: volumeToUnmount.VolumeGidValue,
|
||||
VolumeGIDVolume: volumeToUnmount.VolumeGIDValue,
|
||||
VolumeSpec: volumeToUnmount.VolumeSpec,
|
||||
VolumeMountState: VolumeMountUncertain,
|
||||
}
|
||||
@ -801,14 +801,14 @@ func (og *operationGenerator) GenerateUnmountVolumeFunc(
|
||||
}
|
||||
|
||||
klog.Infof(
|
||||
"UnmountVolume.TearDown succeeded for volume %q (OuterVolumeSpecName: %q) pod %q (UID: %q). InnerVolumeSpecName %q. PluginName %q, VolumeGidValue %q",
|
||||
"UnmountVolume.TearDown succeeded for volume %q (OuterVolumeSpecName: %q) pod %q (UID: %q). InnerVolumeSpecName %q. PluginName %q, VolumeGIDValue %q",
|
||||
volumeToUnmount.VolumeName,
|
||||
volumeToUnmount.OuterVolumeSpecName,
|
||||
volumeToUnmount.PodName,
|
||||
volumeToUnmount.PodUID,
|
||||
volumeToUnmount.InnerVolumeSpecName,
|
||||
volumeToUnmount.PluginName,
|
||||
volumeToUnmount.VolumeGidValue)
|
||||
volumeToUnmount.VolumeGIDValue)
|
||||
|
||||
// Update actual state of world
|
||||
markVolMountedErr := actualStateOfWorld.MarkVolumeAsUnmounted(
|
||||
@ -1052,7 +1052,7 @@ func (og *operationGenerator) GenerateMapVolumeFunc(
|
||||
VolumeName: volumeToMount.VolumeName,
|
||||
BlockVolumeMapper: blockVolumeMapper,
|
||||
OuterVolumeSpecName: volumeToMount.OuterVolumeSpecName,
|
||||
VolumeGidVolume: volumeToMount.VolumeGidValue,
|
||||
VolumeGIDVolume: volumeToMount.VolumeGIDValue,
|
||||
VolumeSpec: volumeToMount.VolumeSpec,
|
||||
VolumeMountState: VolumeMounted,
|
||||
}
|
||||
@ -1225,7 +1225,7 @@ func (og *operationGenerator) GenerateUnmapVolumeFunc(
|
||||
PodUID: volumeToUnmount.PodUID,
|
||||
VolumeName: volumeToUnmount.VolumeName,
|
||||
OuterVolumeSpecName: volumeToUnmount.OuterVolumeSpecName,
|
||||
VolumeGidVolume: volumeToUnmount.VolumeGidValue,
|
||||
VolumeGIDVolume: volumeToUnmount.VolumeGIDValue,
|
||||
VolumeSpec: volumeToUnmount.VolumeSpec,
|
||||
VolumeMountState: VolumeMountUncertain,
|
||||
}
|
||||
@ -1256,14 +1256,14 @@ func (og *operationGenerator) GenerateUnmapVolumeFunc(
|
||||
}
|
||||
|
||||
klog.Infof(
|
||||
"UnmapVolume succeeded for volume %q (OuterVolumeSpecName: %q) pod %q (UID: %q). InnerVolumeSpecName %q. PluginName %q, VolumeGidValue %q",
|
||||
"UnmapVolume succeeded for volume %q (OuterVolumeSpecName: %q) pod %q (UID: %q). InnerVolumeSpecName %q. PluginName %q, VolumeGIDValue %q",
|
||||
volumeToUnmount.VolumeName,
|
||||
volumeToUnmount.OuterVolumeSpecName,
|
||||
volumeToUnmount.PodName,
|
||||
volumeToUnmount.PodUID,
|
||||
volumeToUnmount.InnerVolumeSpecName,
|
||||
volumeToUnmount.PluginName,
|
||||
volumeToUnmount.VolumeGidValue)
|
||||
volumeToUnmount.VolumeGIDValue)
|
||||
|
||||
// Update actual state of world
|
||||
markVolUnmountedErr := actualStateOfWorld.MarkVolumeAsUnmounted(
|
||||
|
Loading…
Reference in New Issue
Block a user