@@ -41,6 +41,17 @@ import (
4141 "sigs.k8s.io/controller-runtime/pkg/log/zap"
4242)
4343
44+ var (
45+ // available recorders for the --volume-condition-recorders flag
46+ volumeConditionLogRecorder = "log"
47+ volumeConditionPVCEventRecorder = "pvcEvent"
48+
49+ defaultVolumeConditionRecorders = strings .Join ([]string {
50+ volumeConditionLogRecorder ,
51+ volumeConditionPVCEventRecorder ,
52+ }, "," )
53+ )
54+
4455func main () {
4556 var (
4657 defaultTimeout = time .Minute * 3
@@ -67,7 +78,7 @@ func main() {
6778 // volume condition reporting
6879 enableVolumeCondition = flag .Bool ("enable-volume-condition" , false , "Enable reporting of the volume condition" )
6980 volumeConditionInterval = flag .Duration ("volume-condition-interval" , 1 * time .Minute , "Interval between volume condition checks" )
70- volumeConditionRecorders = flag .String ("volume-condition-recorders" , "log,pvcEvent" , "location(s) to report volume condition to" )
81+ volumeConditionRecorders = flag .String ("volume-condition-recorders" , defaultVolumeConditionRecorders , "location(s) to report volume condition to" )
7182 )
7283 klog .InitFlags (nil )
7384
@@ -148,9 +159,9 @@ func main() {
148159 recorderOptions := make ([]condition.RecorderOption , 0 )
149160 for _ , vcr := range strings .Split (* volumeConditionRecorders , "," ) {
150161 switch vcr {
151- case "log" :
162+ case volumeConditionLogRecorder :
152163 recorderOptions = append (recorderOptions , condition .WithLogRecorder ())
153- case "pvcEvent" :
164+ case volumeConditionPVCEventRecorder :
154165 recorderOptions = append (recorderOptions , condition .WithEventRecorder ())
155166 default :
156167 klog .Infof ("condition recorder %q is unknown, skipping" , vcr )
0 commit comments