@@ -30,8 +30,8 @@ import (
30
30
"k8s.io/client-go/tools/leaderelection/resourcelock"
31
31
"k8s.io/client-go/tools/record"
32
32
"k8s.io/client-go/util/workqueue"
33
+ "k8s.io/klog/v2"
33
34
34
- "github.com/golang/glog"
35
35
"github.com/spf13/viper"
36
36
)
37
37
@@ -223,14 +223,14 @@ func (c *ObjectStorageController) Run(ctx context.Context) error {
223
223
RetryPeriod : c .RetryPeriod ,
224
224
Callbacks : leaderelection.LeaderCallbacks {
225
225
OnStartedLeading : func (ctx context.Context ) {
226
- glog .V (2 ).Info ("became leader, starting" )
226
+ klog .V (2 ).InfoS ("became leader, starting controller " )
227
227
c .runController (ctx )
228
228
},
229
229
OnStoppedLeading : func () {
230
- glog . Infof ("stopped leading" )
230
+ klog . InfoS ("stopped leading" )
231
231
},
232
232
OnNewLeader : func (identity string ) {
233
- glog .V (3 ).Infof ("new leader detected, current leader: %s " , identity )
233
+ klog .V (3 ).InfoS ("new leader detected" , "name " , identity )
234
234
},
235
235
},
236
236
}
@@ -270,35 +270,23 @@ func (c *ObjectStorageController) processNextItem(ctx context.Context) bool {
270
270
case addOp :
271
271
add := * o .AddFunc
272
272
objMeta := o .Object .(metav1.Object )
273
- name := objMeta .GetName ()
274
- ns := objMeta .GetNamespace ()
275
273
err = add (ctx , o .Object )
276
274
if err == nil {
277
275
o .Indexer .Add (o .Object )
278
- } else {
279
- glog .Errorf ("Error adding %s %s: %v" , ns , name , err )
280
276
}
281
277
case updateOp :
282
278
update := * o .UpdateFunc
283
279
objMeta := o .OldObject .(metav1.Object )
284
- name := objMeta .GetName ()
285
- ns := objMeta .GetNamespace ()
286
280
err = update (ctx , o .OldObject , o .NewObject )
287
281
if err == nil {
288
282
o .Indexer .Update (o .NewObject )
289
- } else {
290
- glog .Errorf ("Error updating %s %s: %v" , ns , name , err )
291
283
}
292
284
case deleteOp :
293
285
delete := * o .DeleteFunc
294
286
objMeta := o .Object .(metav1.Object )
295
- name := objMeta .GetName ()
296
- ns := objMeta .GetNamespace ()
297
287
err = delete (ctx , o .Object )
298
288
if err == nil {
299
289
o .Indexer .Delete (o .Object )
300
- } else {
301
- glog .Errorf ("Error deleting %s %s: %v" , ns , name , err )
302
290
}
303
291
default :
304
292
panic ("unknown item in queue" )
@@ -425,7 +413,6 @@ func (c *ObjectStorageController) runController(ctx context.Context) {
425
413
defer utilruntime .HandleCrash ()
426
414
defer c .queue .ShutDown ()
427
415
428
- glog .V (1 ).Infof ("Starting %s controller" , name )
429
416
go ctrlr .Run (ctx .Done ())
430
417
431
418
if ! cache .WaitForCacheSync (ctx .Done (), ctrlr .HasSynced ) {
@@ -438,7 +425,6 @@ func (c *ObjectStorageController) runController(ctx context.Context) {
438
425
}
439
426
440
427
<- ctx .Done ()
441
- glog .V (3 ).Infof ("Stopping %s controller" , name )
442
428
}
443
429
444
430
if c .BucketListener != nil {
0 commit comments