From 9b9dcf3d8457ce52a76f0c76367dc24cadb7290c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Guilherme=20Vanz?= Date: Tue, 7 Jul 2020 11:21:42 -0300 Subject: [PATCH 1/3] cleanup: decrease log level from warn to v3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a pod has a configmap/secret volume an annoying message shows up in the log approximately every 70 seconds. This happens because the desiredStateOfWorldPopulator sync loop always call the MarkRemountRequired. The function finds the volume plugin and check if the plugin requires mount. Configmap and secret plugins always returns true for that. Thus, the reconciler code of the volume manager remounts the volume every time. This commit decrease the log level of that message in the mount function from warning to V4. Signed-off-by: José Guilherme Vanz --- pkg/volume/volume_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/volume/volume_linux.go b/pkg/volume/volume_linux.go index d7b8e87c7da..602452e6bf0 100644 --- a/pkg/volume/volume_linux.go +++ b/pkg/volume/volume_linux.go @@ -46,7 +46,7 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64, fsGroupChangePolicy *v1 fsGroupPolicyEnabled := utilfeature.DefaultFeatureGate.Enabled(features.ConfigurableFSGroupPolicy) - klog.Warningf("Setting volume ownership for %s and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699", mounter.GetPath()) + klog.V(3).Infof("Setting volume ownership for %s and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699", mounter.GetPath()) // This code exists for legacy purposes, so as old behaviour is entirely preserved when feature gate is disabled // TODO: remove this when ConfigurableFSGroupPolicy turns GA. From 08ccbe6f0ed579b8969709f21ceb651ce4568a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Guilherme=20Vanz?= Date: Mon, 20 Jul 2020 09:28:21 -0300 Subject: [PATCH 2/3] Revert "cleanup: decrease log level from warn to v3" This reverts commit ebece49936e635f151fdd8a64fa2b77fd183e817. --- pkg/volume/volume_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/volume/volume_linux.go b/pkg/volume/volume_linux.go index 602452e6bf0..d7b8e87c7da 100644 --- a/pkg/volume/volume_linux.go +++ b/pkg/volume/volume_linux.go @@ -46,7 +46,7 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64, fsGroupChangePolicy *v1 fsGroupPolicyEnabled := utilfeature.DefaultFeatureGate.Enabled(features.ConfigurableFSGroupPolicy) - klog.V(3).Infof("Setting volume ownership for %s and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699", mounter.GetPath()) + klog.Warningf("Setting volume ownership for %s and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699", mounter.GetPath()) // This code exists for legacy purposes, so as old behaviour is entirely preserved when feature gate is disabled // TODO: remove this when ConfigurableFSGroupPolicy turns GA. From 5ebb1c3be231c6c653af33b84a3084662f8f0743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Guilherme=20Vanz?= Date: Mon, 20 Jul 2020 10:41:53 -0300 Subject: [PATCH 3/3] cleanup: print warning message after timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a pod has a configmap/secret volume an annoying message shows up in the log approximately every 70 seconds. This happens because the desiredStateOfWorldPopulator sync loop always call the MarkRemountRequired. The function finds the volume plugin and check if the plugin requires mount. Configmap and secret plugins always returns true for that. Thus, the reconciler code of the volume manager remounts the volume every time. This commit change the SetVolumeOwnership to print the warning only if the function does not finish within 30 seconds. Signed-off-by: José Guilherme Vanz --- pkg/volume/volume_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/volume/volume_linux.go b/pkg/volume/volume_linux.go index d7b8e87c7da..ebef818d2a9 100644 --- a/pkg/volume/volume_linux.go +++ b/pkg/volume/volume_linux.go @@ -23,6 +23,7 @@ import ( "syscall" "os" + "time" v1 "k8s.io/api/core/v1" utilfeature "k8s.io/apiserver/pkg/util/feature" @@ -46,7 +47,10 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64, fsGroupChangePolicy *v1 fsGroupPolicyEnabled := utilfeature.DefaultFeatureGate.Enabled(features.ConfigurableFSGroupPolicy) - klog.Warningf("Setting volume ownership for %s and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699", mounter.GetPath()) + timer := time.AfterFunc(30*time.Second, func() { + klog.Warningf("Setting volume ownership for %s and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699", mounter.GetPath()) + }) + defer timer.Stop() // This code exists for legacy purposes, so as old behaviour is entirely preserved when feature gate is disabled // TODO: remove this when ConfigurableFSGroupPolicy turns GA.