mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Rework volume manager log levels
- all normal logs to go to level 4 - too frequent / duplicate logs go to level 5 (e.g. when something else logged similar message not too far away).
This commit is contained in:
		@@ -236,13 +236,13 @@ func (dswp *desiredStateOfWorldPopulator) findAndRemoveDeletedPods() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if runningContainers {
 | 
			
		||||
			glog.V(5).Infof(
 | 
			
		||||
			glog.V(4).Infof(
 | 
			
		||||
				"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.",
 | 
			
		||||
				format.Pod(volumeToMount.Pod))
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		glog.V(5).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state", ""))
 | 
			
		||||
		glog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state", ""))
 | 
			
		||||
 | 
			
		||||
		dswp.desiredStateOfWorld.DeletePodFromVolume(
 | 
			
		||||
			volumeToMount.PodName, volumeToMount.VolumeName)
 | 
			
		||||
@@ -292,7 +292,7 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes(pod *v1.Pod) {
 | 
			
		||||
			allVolumesAdded = false
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		glog.V(10).Infof(
 | 
			
		||||
		glog.V(4).Infof(
 | 
			
		||||
			"Added volume %q (volSpec=%q) for pod %q to desired state.",
 | 
			
		||||
			podVolume.Name,
 | 
			
		||||
			volumeSpec.Name(),
 | 
			
		||||
@@ -343,7 +343,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
 | 
			
		||||
	podVolume v1.Volume, podName string, podNamespace string, mountsMap map[string]bool, devicesMap map[string]bool) (*volume.Spec, string, error) {
 | 
			
		||||
	if pvcSource :=
 | 
			
		||||
		podVolume.VolumeSource.PersistentVolumeClaim; pvcSource != nil {
 | 
			
		||||
		glog.V(10).Infof(
 | 
			
		||||
		glog.V(5).Infof(
 | 
			
		||||
			"Found PVC, ClaimName: %q/%q",
 | 
			
		||||
			podNamespace,
 | 
			
		||||
			pvcSource.ClaimName)
 | 
			
		||||
@@ -359,7 +359,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
 | 
			
		||||
				err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		glog.V(10).Infof(
 | 
			
		||||
		glog.V(5).Infof(
 | 
			
		||||
			"Found bound PV for PVC (ClaimName %q/%q pvcUID %v): pvName=%q",
 | 
			
		||||
			podNamespace,
 | 
			
		||||
			pvcSource.ClaimName,
 | 
			
		||||
@@ -377,7 +377,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
 | 
			
		||||
				err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		glog.V(10).Infof(
 | 
			
		||||
		glog.V(5).Infof(
 | 
			
		||||
			"Extracted volumeSpec (%v) from bound PV (pvName %q) and PVC (ClaimName %q/%q pvcUID %v)",
 | 
			
		||||
			volumeSpec.Name,
 | 
			
		||||
			pvName,
 | 
			
		||||
 
 | 
			
		||||
@@ -167,7 +167,7 @@ func (rc *reconciler) reconcile() {
 | 
			
		||||
	for _, mountedVolume := range rc.actualStateOfWorld.GetMountedVolumes() {
 | 
			
		||||
		if !rc.desiredStateOfWorld.PodExistsInVolume(mountedVolume.PodName, mountedVolume.VolumeName) {
 | 
			
		||||
			// Volume is mounted, unmount it
 | 
			
		||||
			glog.V(12).Infof(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", ""))
 | 
			
		||||
			glog.V(5).Infof(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", ""))
 | 
			
		||||
			err := rc.operationExecutor.UnmountVolume(
 | 
			
		||||
				mountedVolume.MountedVolume, rc.actualStateOfWorld)
 | 
			
		||||
			if err != nil &&
 | 
			
		||||
@@ -191,7 +191,7 @@ func (rc *reconciler) reconcile() {
 | 
			
		||||
			if rc.controllerAttachDetachEnabled || !volumeToMount.PluginIsAttachable {
 | 
			
		||||
				// Volume is not attached (or doesn't implement attacher), kubelet attach is disabled, wait
 | 
			
		||||
				// for controller to finish attaching volume.
 | 
			
		||||
				glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.VerifyControllerAttachedVolume", ""))
 | 
			
		||||
				glog.V(5).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.VerifyControllerAttachedVolume", ""))
 | 
			
		||||
				err := rc.operationExecutor.VerifyControllerAttachedVolume(
 | 
			
		||||
					volumeToMount.VolumeToMount,
 | 
			
		||||
					rc.nodeName,
 | 
			
		||||
@@ -214,7 +214,7 @@ func (rc *reconciler) reconcile() {
 | 
			
		||||
					VolumeSpec: volumeToMount.VolumeSpec,
 | 
			
		||||
					NodeName:   rc.nodeName,
 | 
			
		||||
				}
 | 
			
		||||
				glog.V(12).Infof(volumeToAttach.GenerateMsgDetailed("Starting operationExecutor.AttachVolume", ""))
 | 
			
		||||
				glog.V(5).Infof(volumeToAttach.GenerateMsgDetailed("Starting operationExecutor.AttachVolume", ""))
 | 
			
		||||
				err := rc.operationExecutor.AttachVolume(volumeToAttach, rc.actualStateOfWorld)
 | 
			
		||||
				if err != nil &&
 | 
			
		||||
					!nestedpendingoperations.IsAlreadyExists(err) &&
 | 
			
		||||
@@ -234,7 +234,7 @@ func (rc *reconciler) reconcile() {
 | 
			
		||||
			if isRemount {
 | 
			
		||||
				remountingLogStr = "Volume is already mounted to pod, but remount was requested."
 | 
			
		||||
			}
 | 
			
		||||
			glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr))
 | 
			
		||||
			glog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr))
 | 
			
		||||
			err := rc.operationExecutor.MountVolume(
 | 
			
		||||
				rc.waitForAttachTimeout,
 | 
			
		||||
				volumeToMount.VolumeToMount,
 | 
			
		||||
@@ -264,7 +264,7 @@ func (rc *reconciler) reconcile() {
 | 
			
		||||
			!rc.operationExecutor.IsOperationPending(attachedVolume.VolumeName, nestedpendingoperations.EmptyUniquePodName) {
 | 
			
		||||
			if attachedVolume.GloballyMounted {
 | 
			
		||||
				// Volume is globally mounted to device, unmount it
 | 
			
		||||
				glog.V(12).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountDevice", ""))
 | 
			
		||||
				glog.V(5).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountDevice", ""))
 | 
			
		||||
				err := rc.operationExecutor.UnmountDevice(
 | 
			
		||||
					attachedVolume.AttachedVolume, rc.actualStateOfWorld, rc.mounter)
 | 
			
		||||
				if err != nil &&
 | 
			
		||||
@@ -285,7 +285,7 @@ func (rc *reconciler) reconcile() {
 | 
			
		||||
					glog.Infof(attachedVolume.GenerateMsgDetailed("Volume detached", fmt.Sprintf("DevicePath %q", attachedVolume.DevicePath)))
 | 
			
		||||
				} else {
 | 
			
		||||
					// Only detach if kubelet detach is enabled
 | 
			
		||||
					glog.V(12).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.DetachVolume", ""))
 | 
			
		||||
					glog.V(5).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.DetachVolume", ""))
 | 
			
		||||
					err := rc.operationExecutor.DetachVolume(
 | 
			
		||||
						attachedVolume.AttachedVolume, false /* verifySafeToDetach */, rc.actualStateOfWorld)
 | 
			
		||||
					if err != nil &&
 | 
			
		||||
 
 | 
			
		||||
@@ -844,7 +844,7 @@ func (oe *operationExecutor) ReconstructVolumeOperation(
 | 
			
		||||
	// Filesystem Volume case
 | 
			
		||||
	if volumeMode == v1.PersistentVolumeFilesystem {
 | 
			
		||||
		// Create volumeSpec from mount path
 | 
			
		||||
		glog.V(12).Infof("Starting operationExecutor.ReconstructVolumepodName")
 | 
			
		||||
		glog.V(5).Infof("Starting operationExecutor.ReconstructVolumepodName")
 | 
			
		||||
		volumeSpec, err := plugin.ConstructVolumeSpec(volumeSpecName, mountPath)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
@@ -854,7 +854,7 @@ func (oe *operationExecutor) ReconstructVolumeOperation(
 | 
			
		||||
 | 
			
		||||
	// Block Volume case
 | 
			
		||||
	// Create volumeSpec from mount path
 | 
			
		||||
	glog.V(12).Infof("Starting operationExecutor.ReconstructVolume")
 | 
			
		||||
	glog.V(5).Infof("Starting operationExecutor.ReconstructVolume")
 | 
			
		||||
	if mapperPlugin == nil {
 | 
			
		||||
		return nil, fmt.Errorf("Could not find block volume plugin %q (spec.Name: %q) pod %q (UID: %q)",
 | 
			
		||||
			pluginName,
 | 
			
		||||
 
 | 
			
		||||
@@ -549,7 +549,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
 | 
			
		||||
		simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.SetUp succeeded", "")
 | 
			
		||||
		verbosity := glog.Level(1)
 | 
			
		||||
		if isRemount {
 | 
			
		||||
			verbosity = glog.Level(7)
 | 
			
		||||
			verbosity = glog.Level(4)
 | 
			
		||||
		} else {
 | 
			
		||||
			og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeNormal, kevents.SuccessfulMountVolume, simpleMsg)
 | 
			
		||||
		}
 | 
			
		||||
@@ -587,7 +587,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
 | 
			
		||||
 | 
			
		||||
func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, devicePath, deviceMountPath, pluginName string) (simpleErr, detailedErr error) {
 | 
			
		||||
	if !utilfeature.DefaultFeatureGate.Enabled(features.ExpandPersistentVolumes) {
 | 
			
		||||
		glog.V(6).Infof("Resizing is not enabled for this volume %s", volumeToMount.VolumeName)
 | 
			
		||||
		glog.V(4).Infof("Resizing is not enabled for this volume %s", volumeToMount.VolumeName)
 | 
			
		||||
		return nil, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1063,7 +1063,7 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc(
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// The block volume is not referenced from Pods. Release file descriptor lock.
 | 
			
		||||
		glog.V(5).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath)
 | 
			
		||||
		glog.V(4).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath)
 | 
			
		||||
		loopPath, err := og.blkUtil.GetLoopDevice(deviceToDetach.DevicePath)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			glog.Warningf(deviceToDetach.GenerateMsgDetailed("UnmapDevice: Couldn't find loopback device which takes file descriptor lock", fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user