mirror of https://github.com/k3s-io/k3s
Merge pull request #59923 from jsafrane/volumemanager-logs
Automatic merge from submit-queue (batch tested with PRs 59873, 59933, 59923, 59944, 59953). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. 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). I checked that there is no excessive spam in the log - reconciler runs every 100ms, but it does not log anything if there is nothing to do. **What this PR does / why we need it**: This will help us debug flakes. E2e tests do not log levels 10-12 used in volume manager **Release note**: ```release-note NONE ``` /sig storage /sig node cc: @jingxu97 @sjenningpull/6/head
commit
99c87cf679
|
@ -239,13 +239,13 @@ func (dswp *desiredStateOfWorldPopulator) findAndRemoveDeletedPods() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if runningContainers {
|
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.",
|
"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))
|
format.Pod(volumeToMount.Pod))
|
||||||
continue
|
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(
|
dswp.desiredStateOfWorld.DeletePodFromVolume(
|
||||||
volumeToMount.PodName, volumeToMount.VolumeName)
|
volumeToMount.PodName, volumeToMount.VolumeName)
|
||||||
|
@ -295,7 +295,7 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes(pod *v1.Pod) {
|
||||||
allVolumesAdded = false
|
allVolumesAdded = false
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(10).Infof(
|
glog.V(4).Infof(
|
||||||
"Added volume %q (volSpec=%q) for pod %q to desired state.",
|
"Added volume %q (volSpec=%q) for pod %q to desired state.",
|
||||||
podVolume.Name,
|
podVolume.Name,
|
||||||
volumeSpec.Name(),
|
volumeSpec.Name(),
|
||||||
|
@ -349,7 +349,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
||||||
podVolume v1.Volume, podName string, podNamespace string, mountsMap map[string]bool, devicesMap map[string]bool) (*volume.Spec, string, error) {
|
podVolume v1.Volume, podName string, podNamespace string, mountsMap map[string]bool, devicesMap map[string]bool) (*volume.Spec, string, error) {
|
||||||
if pvcSource :=
|
if pvcSource :=
|
||||||
podVolume.VolumeSource.PersistentVolumeClaim; pvcSource != nil {
|
podVolume.VolumeSource.PersistentVolumeClaim; pvcSource != nil {
|
||||||
glog.V(10).Infof(
|
glog.V(5).Infof(
|
||||||
"Found PVC, ClaimName: %q/%q",
|
"Found PVC, ClaimName: %q/%q",
|
||||||
podNamespace,
|
podNamespace,
|
||||||
pvcSource.ClaimName)
|
pvcSource.ClaimName)
|
||||||
|
@ -365,7 +365,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(10).Infof(
|
glog.V(5).Infof(
|
||||||
"Found bound PV for PVC (ClaimName %q/%q pvcUID %v): pvName=%q",
|
"Found bound PV for PVC (ClaimName %q/%q pvcUID %v): pvName=%q",
|
||||||
podNamespace,
|
podNamespace,
|
||||||
pvcSource.ClaimName,
|
pvcSource.ClaimName,
|
||||||
|
@ -383,7 +383,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(10).Infof(
|
glog.V(5).Infof(
|
||||||
"Extracted volumeSpec (%v) from bound PV (pvName %q) and PVC (ClaimName %q/%q pvcUID %v)",
|
"Extracted volumeSpec (%v) from bound PV (pvName %q) and PVC (ClaimName %q/%q pvcUID %v)",
|
||||||
volumeSpec.Name,
|
volumeSpec.Name,
|
||||||
pvName,
|
pvName,
|
||||||
|
|
|
@ -167,7 +167,7 @@ func (rc *reconciler) reconcile() {
|
||||||
for _, mountedVolume := range rc.actualStateOfWorld.GetMountedVolumes() {
|
for _, mountedVolume := range rc.actualStateOfWorld.GetMountedVolumes() {
|
||||||
if !rc.desiredStateOfWorld.PodExistsInVolume(mountedVolume.PodName, mountedVolume.VolumeName) {
|
if !rc.desiredStateOfWorld.PodExistsInVolume(mountedVolume.PodName, mountedVolume.VolumeName) {
|
||||||
// Volume is mounted, unmount it
|
// 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(
|
err := rc.operationExecutor.UnmountVolume(
|
||||||
mountedVolume.MountedVolume, rc.actualStateOfWorld)
|
mountedVolume.MountedVolume, rc.actualStateOfWorld)
|
||||||
if err != nil &&
|
if err != nil &&
|
||||||
|
@ -191,7 +191,7 @@ func (rc *reconciler) reconcile() {
|
||||||
if rc.controllerAttachDetachEnabled || !volumeToMount.PluginIsAttachable {
|
if rc.controllerAttachDetachEnabled || !volumeToMount.PluginIsAttachable {
|
||||||
// Volume is not attached (or doesn't implement attacher), kubelet attach is disabled, wait
|
// Volume is not attached (or doesn't implement attacher), kubelet attach is disabled, wait
|
||||||
// for controller to finish attaching volume.
|
// 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(
|
err := rc.operationExecutor.VerifyControllerAttachedVolume(
|
||||||
volumeToMount.VolumeToMount,
|
volumeToMount.VolumeToMount,
|
||||||
rc.nodeName,
|
rc.nodeName,
|
||||||
|
@ -214,7 +214,7 @@ func (rc *reconciler) reconcile() {
|
||||||
VolumeSpec: volumeToMount.VolumeSpec,
|
VolumeSpec: volumeToMount.VolumeSpec,
|
||||||
NodeName: rc.nodeName,
|
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)
|
err := rc.operationExecutor.AttachVolume(volumeToAttach, rc.actualStateOfWorld)
|
||||||
if err != nil &&
|
if err != nil &&
|
||||||
!nestedpendingoperations.IsAlreadyExists(err) &&
|
!nestedpendingoperations.IsAlreadyExists(err) &&
|
||||||
|
@ -234,7 +234,7 @@ func (rc *reconciler) reconcile() {
|
||||||
if isRemount {
|
if isRemount {
|
||||||
remountingLogStr = "Volume is already mounted to pod, but remount was requested."
|
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(
|
err := rc.operationExecutor.MountVolume(
|
||||||
rc.waitForAttachTimeout,
|
rc.waitForAttachTimeout,
|
||||||
volumeToMount.VolumeToMount,
|
volumeToMount.VolumeToMount,
|
||||||
|
@ -264,7 +264,7 @@ func (rc *reconciler) reconcile() {
|
||||||
!rc.operationExecutor.IsOperationPending(attachedVolume.VolumeName, nestedpendingoperations.EmptyUniquePodName) {
|
!rc.operationExecutor.IsOperationPending(attachedVolume.VolumeName, nestedpendingoperations.EmptyUniquePodName) {
|
||||||
if attachedVolume.GloballyMounted {
|
if attachedVolume.GloballyMounted {
|
||||||
// Volume is globally mounted to device, unmount it
|
// 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(
|
err := rc.operationExecutor.UnmountDevice(
|
||||||
attachedVolume.AttachedVolume, rc.actualStateOfWorld, rc.mounter)
|
attachedVolume.AttachedVolume, rc.actualStateOfWorld, rc.mounter)
|
||||||
if err != nil &&
|
if err != nil &&
|
||||||
|
@ -285,7 +285,7 @@ func (rc *reconciler) reconcile() {
|
||||||
glog.Infof(attachedVolume.GenerateMsgDetailed("Volume detached", fmt.Sprintf("DevicePath %q", attachedVolume.DevicePath)))
|
glog.Infof(attachedVolume.GenerateMsgDetailed("Volume detached", fmt.Sprintf("DevicePath %q", attachedVolume.DevicePath)))
|
||||||
} else {
|
} else {
|
||||||
// Only detach if kubelet detach is enabled
|
// 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(
|
err := rc.operationExecutor.DetachVolume(
|
||||||
attachedVolume.AttachedVolume, false /* verifySafeToDetach */, rc.actualStateOfWorld)
|
attachedVolume.AttachedVolume, false /* verifySafeToDetach */, rc.actualStateOfWorld)
|
||||||
if err != nil &&
|
if err != nil &&
|
||||||
|
|
|
@ -844,7 +844,7 @@ func (oe *operationExecutor) ReconstructVolumeOperation(
|
||||||
// Filesystem Volume case
|
// Filesystem Volume case
|
||||||
if volumeMode == v1.PersistentVolumeFilesystem {
|
if volumeMode == v1.PersistentVolumeFilesystem {
|
||||||
// Create volumeSpec from mount path
|
// 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)
|
volumeSpec, err := plugin.ConstructVolumeSpec(volumeSpecName, mountPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -854,7 +854,7 @@ func (oe *operationExecutor) ReconstructVolumeOperation(
|
||||||
|
|
||||||
// Block Volume case
|
// Block Volume case
|
||||||
// Create volumeSpec from mount path
|
// Create volumeSpec from mount path
|
||||||
glog.V(12).Infof("Starting operationExecutor.ReconstructVolume")
|
glog.V(5).Infof("Starting operationExecutor.ReconstructVolume")
|
||||||
if mapperPlugin == nil {
|
if mapperPlugin == nil {
|
||||||
return nil, fmt.Errorf("Could not find block volume plugin %q (spec.Name: %q) pod %q (UID: %q)",
|
return nil, fmt.Errorf("Could not find block volume plugin %q (spec.Name: %q) pod %q (UID: %q)",
|
||||||
pluginName,
|
pluginName,
|
||||||
|
|
|
@ -549,7 +549,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
|
||||||
simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.SetUp succeeded", "")
|
simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.SetUp succeeded", "")
|
||||||
verbosity := glog.Level(1)
|
verbosity := glog.Level(1)
|
||||||
if isRemount {
|
if isRemount {
|
||||||
verbosity = glog.Level(7)
|
verbosity = glog.Level(4)
|
||||||
} else {
|
} else {
|
||||||
og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeNormal, kevents.SuccessfulMountVolume, simpleMsg)
|
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) {
|
func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, devicePath, deviceMountPath, pluginName string) (simpleErr, detailedErr error) {
|
||||||
if !utilfeature.DefaultFeatureGate.Enabled(features.ExpandPersistentVolumes) {
|
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
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1063,7 +1063,7 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc(
|
||||||
}
|
}
|
||||||
|
|
||||||
// The block volume is not referenced from Pods. Release file descriptor lock.
|
// 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)
|
loopPath, err := og.blkUtil.GetLoopDevice(deviceToDetach.DevicePath)
|
||||||
if err != nil {
|
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)))
|
glog.Warningf(deviceToDetach.GenerateMsgDetailed("UnmapDevice: Couldn't find loopback device which takes file descriptor lock", fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)))
|
||||||
|
|
Loading…
Reference in New Issue