Skip to content

Commit 5760cef

Browse files
authored
Merge pull request kubernetes#92878 from jvanz/issue90293
cleanup: print warning message only if the function does not finish within 30 seconds
2 parents 481830b + 5ebb1c3 commit 5760cef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/volume/volume_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"syscall"
2424

2525
"os"
26+
"time"
2627

2728
v1 "k8s.io/api/core/v1"
2829
utilfeature "k8s.io/apiserver/pkg/util/feature"
@@ -46,7 +47,10 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64, fsGroupChangePolicy *v1
4647

4748
fsGroupPolicyEnabled := utilfeature.DefaultFeatureGate.Enabled(features.ConfigurableFSGroupPolicy)
4849

49-
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())
50+
timer := time.AfterFunc(30*time.Second, func() {
51+
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())
52+
})
53+
defer timer.Stop()
5054

5155
// This code exists for legacy purposes, so as old behaviour is entirely preserved when feature gate is disabled
5256
// TODO: remove this when ConfigurableFSGroupPolicy turns GA.

0 commit comments

Comments
 (0)