Skip to content

Commit 67d1dde

Browse files
Merge pull request kubernetes#18636 from sjenning/picks-volume-manager
Automatic merge from submit-queue. Picks for volume manager Thanks to @jsafrane for these fixes kubernetes#59873 kubernetes#59923 59923 modified from upstream because some logging levels where already higher in 1.9 xref https://bugzilla.redhat.com/show_bug.cgi?id=1538216 Fixes openshift/origin#17605 Fixes openshift/origin#17556 @derekwaynecarr Origin-commit: e4f2115102c01124cc7f168b7f1ae4c65f190875
2 parents af2aa1a + 63f2466 commit 67d1dde

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed

pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go

+12-6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func NewDesiredStateOfWorldPopulator(
8484
podManager pod.Manager,
8585
podStatusProvider status.PodStatusProvider,
8686
desiredStateOfWorld cache.DesiredStateOfWorld,
87+
actualStateOfWorld cache.ActualStateOfWorld,
8788
kubeContainerRuntime kubecontainer.Runtime,
8889
keepTerminatedPodVolumes bool) DesiredStateOfWorldPopulator {
8990
return &desiredStateOfWorldPopulator{
@@ -93,6 +94,7 @@ func NewDesiredStateOfWorldPopulator(
9394
podManager: podManager,
9495
podStatusProvider: podStatusProvider,
9596
desiredStateOfWorld: desiredStateOfWorld,
97+
actualStateOfWorld: actualStateOfWorld,
9698
pods: processedPods{
9799
processedPods: make(map[volumetypes.UniquePodName]bool)},
98100
kubeContainerRuntime: kubeContainerRuntime,
@@ -109,6 +111,7 @@ type desiredStateOfWorldPopulator struct {
109111
podManager pod.Manager
110112
podStatusProvider status.PodStatusProvider
111113
desiredStateOfWorld cache.DesiredStateOfWorld
114+
actualStateOfWorld cache.ActualStateOfWorld
112115
pods processedPods
113116
kubeContainerRuntime kubecontainer.Runtime
114117
timeOfLastGetPodStatus time.Time
@@ -237,13 +240,13 @@ func (dswp *desiredStateOfWorldPopulator) findAndRemoveDeletedPods() {
237240
}
238241

239242
if runningContainers {
240-
glog.V(5).Infof(
243+
glog.V(4).Infof(
241244
"Pod %q has been removed from pod manager. However, it still has one or more containers in the non-exited state. Therefore, it will not be removed from volume manager.",
242245
format.Pod(volumeToMount.Pod))
243246
continue
244247
}
245248

246-
glog.V(5).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state", ""))
249+
glog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state", ""))
247250

248251
dswp.desiredStateOfWorld.DeletePodFromVolume(
249252
volumeToMount.PodName, volumeToMount.VolumeName)
@@ -293,7 +296,7 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes(pod *v1.Pod) {
293296
allVolumesAdded = false
294297
}
295298

296-
glog.V(10).Infof(
299+
glog.V(4).Infof(
297300
"Added volume %q (volSpec=%q) for pod %q to desired state.",
298301
podVolume.Name,
299302
volumeSpec.Name(),
@@ -303,6 +306,9 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes(pod *v1.Pod) {
303306
// some of the volume additions may have failed, should not mark this pod as fully processed
304307
if allVolumesAdded {
305308
dswp.markPodProcessed(uniquePodName)
309+
// New pod has been synced. Re-mount all volumes that need it
310+
// (e.g. DownwardAPI)
311+
dswp.actualStateOfWorld.MarkRemountRequired(uniquePodName)
306312
}
307313

308314
}
@@ -344,7 +350,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
344350
podVolume v1.Volume, podName string, podNamespace string, mountsMap map[string]bool, devicesMap map[string]bool) (*volume.Spec, string, error) {
345351
if pvcSource :=
346352
podVolume.VolumeSource.PersistentVolumeClaim; pvcSource != nil {
347-
glog.V(10).Infof(
353+
glog.V(5).Infof(
348354
"Found PVC, ClaimName: %q/%q",
349355
podNamespace,
350356
pvcSource.ClaimName)
@@ -360,7 +366,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
360366
err)
361367
}
362368

363-
glog.V(10).Infof(
369+
glog.V(5).Infof(
364370
"Found bound PV for PVC (ClaimName %q/%q pvcUID %v): pvName=%q",
365371
podNamespace,
366372
pvcSource.ClaimName,
@@ -378,7 +384,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
378384
err)
379385
}
380386

381-
glog.V(10).Infof(
387+
glog.V(5).Infof(
382388
"Extracted volumeSpec (%v) from bound PV (pvName %q) and PVC (ClaimName %q/%q pvcUID %v)",
383389
volumeSpec.Name,
384390
pvName,

pkg/kubelet/volumemanager/populator/desired_state_of_world_populator_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ func createDswpWithVolume(t *testing.T, pv *v1.PersistentVolume, pvc *v1.Persist
525525
podtest.NewFakeMirrorClient(), fakeSecretManager, fakeConfigMapManager)
526526

527527
fakesDSW := cache.NewDesiredStateOfWorld(fakeVolumePluginMgr)
528+
fakeASW := cache.NewActualStateOfWorld("fake", fakeVolumePluginMgr)
528529
fakeRuntime := &containertest.FakeRuntime{}
529530

530531
fakeStatusManager := status.NewManager(fakeClient, fakePodManager, &statustest.FakePodDeletionSafetyProvider{})
@@ -536,6 +537,7 @@ func createDswpWithVolume(t *testing.T, pv *v1.PersistentVolume, pvc *v1.Persist
536537
podManager: fakePodManager,
537538
podStatusProvider: fakeStatusManager,
538539
desiredStateOfWorld: fakesDSW,
540+
actualStateOfWorld: fakeASW,
539541
pods: processedPods{
540542
processedPods: make(map[types.UniquePodName]bool)},
541543
kubeContainerRuntime: fakeRuntime,

pkg/kubelet/volumemanager/reconciler/reconciler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (rc *reconciler) reconcile() {
193193
if rc.controllerAttachDetachEnabled || !volumeToMount.PluginIsAttachable {
194194
// Volume is not attached (or doesn't implement attacher), kubelet attach is disabled, wait
195195
// for controller to finish attaching volume.
196-
glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.VerifyControllerAttachedVolume", ""))
196+
glog.V(5).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.VerifyControllerAttachedVolume", ""))
197197
err := rc.operationExecutor.VerifyControllerAttachedVolume(
198198
volumeToMount.VolumeToMount,
199199
rc.nodeName,
@@ -216,7 +216,7 @@ func (rc *reconciler) reconcile() {
216216
VolumeSpec: volumeToMount.VolumeSpec,
217217
NodeName: rc.nodeName,
218218
}
219-
glog.V(12).Infof(volumeToAttach.GenerateMsgDetailed("Starting operationExecutor.AttachVolume", ""))
219+
glog.V(5).Infof(volumeToAttach.GenerateMsgDetailed("Starting operationExecutor.AttachVolume", ""))
220220
err := rc.operationExecutor.AttachVolume(volumeToAttach, rc.actualStateOfWorld)
221221
if err != nil &&
222222
!nestedpendingoperations.IsAlreadyExists(err) &&
@@ -289,7 +289,7 @@ func (rc *reconciler) reconcile() {
289289
glog.Infof(attachedVolume.GenerateMsgDetailed("Volume detached", fmt.Sprintf("DevicePath %q", attachedVolume.DevicePath)))
290290
} else {
291291
// Only detach if kubelet detach is enabled
292-
glog.V(12).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.DetachVolume", ""))
292+
glog.V(5).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.DetachVolume", ""))
293293
err := rc.operationExecutor.DetachVolume(
294294
attachedVolume.AttachedVolume, false /* verifySafeToDetach */, rc.actualStateOfWorld)
295295
if err != nil &&

pkg/kubelet/volumemanager/volume_manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ func NewVolumeManager(
180180
podManager,
181181
podStatusProvider,
182182
vm.desiredStateOfWorld,
183+
vm.actualStateOfWorld,
183184
kubeContainerRuntime,
184185
keepTerminatedPodVolumes)
185186
vm.reconciler = reconciler.NewReconciler(
@@ -346,7 +347,6 @@ func (vm *volumeManager) WaitForAttachAndMount(pod *v1.Pod) error {
346347
// Remount plugins for which this is true. (Atomically updating volumes,
347348
// like Downward API, depend on this to update the contents of the volume).
348349
vm.desiredStateOfWorldPopulator.ReprocessPod(uniquePodName)
349-
vm.actualStateOfWorld.MarkRemountRequired(uniquePodName)
350350

351351
err := wait.Poll(
352352
podAttachAndMountRetryInterval,

pkg/volume/util/operationexecutor/operation_executor.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ type BlockVolumeHandler struct {
917917
// MountVolumeHandler mount/remount a volume when a volume is attached
918918
// This method is handler for filesystem volume
919919
func (f FilesystemVolumeHandler) MountVolumeHandler(waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, actualStateOfWorld ActualStateOfWorldMounterUpdater, isRemount bool, remountingLogStr string) error {
920-
glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr))
920+
glog.V(5).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr))
921921
err := f.oe.MountVolume(
922922
waitForAttachTimeout,
923923
volumeToMount,
@@ -929,7 +929,7 @@ func (f FilesystemVolumeHandler) MountVolumeHandler(waitForAttachTimeout time.Du
929929
// UnmountVolumeHandler unmount a volume if a volume is mounted
930930
// This method is handler for filesystem volume
931931
func (f FilesystemVolumeHandler) UnmountVolumeHandler(mountedVolume MountedVolume, actualStateOfWorld ActualStateOfWorldMounterUpdater) error {
932-
glog.V(12).Infof(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", ""))
932+
glog.V(5).Infof(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", ""))
933933
err := f.oe.UnmountVolume(
934934
mountedVolume,
935935
actualStateOfWorld)
@@ -939,7 +939,7 @@ func (f FilesystemVolumeHandler) UnmountVolumeHandler(mountedVolume MountedVolum
939939
// UnmountDeviceHandler unmount and detach a device if a volume isn't referenced
940940
// This method is handler for filesystem volume
941941
func (f FilesystemVolumeHandler) UnmountDeviceHandler(attachedVolume AttachedVolume, actualStateOfWorld ActualStateOfWorldMounterUpdater, mounter mount.Interface) error {
942-
glog.V(12).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountDevice", ""))
942+
glog.V(5).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountDevice", ""))
943943
err := f.oe.UnmountDevice(
944944
attachedVolume,
945945
actualStateOfWorld,

pkg/volume/util/operationexecutor/operation_generator.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
544544
simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.SetUp succeeded", "")
545545
verbosity := glog.Level(1)
546546
if isRemount {
547-
verbosity = glog.Level(7)
547+
verbosity = glog.Level(4)
548548
} else {
549549
og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeNormal, kevents.SuccessfulMountVolume, simpleMsg)
550550
}
@@ -582,7 +582,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
582582

583583
func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, devicePath, deviceMountPath, pluginName string) error {
584584
if !utilfeature.DefaultFeatureGate.Enabled(features.ExpandPersistentVolumes) {
585-
glog.V(6).Infof("Resizing is not enabled for this volume %s", volumeToMount.VolumeName)
585+
glog.V(4).Infof("Resizing is not enabled for this volume %s", volumeToMount.VolumeName)
586586
return nil
587587
}
588588

@@ -1061,7 +1061,7 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc(
10611061
}
10621062

10631063
// The block volume is not referenced from Pods. Release file descriptor lock.
1064-
glog.V(5).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath)
1064+
glog.V(4).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath)
10651065
loopPath, err := og.blkUtil.GetLoopDevice(deviceToDetach.DevicePath)
10661066
if err != nil {
10671067
glog.Warningf(deviceToDetach.GenerateMsgDetailed("UnmapDevice: Couldn't find loopback device which takes file descriptor lock", fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)))

0 commit comments

Comments
 (0)