@@ -23,7 +23,7 @@ import (
23
23
"sync"
24
24
"sync/atomic"
25
25
26
- "github.com/golang/glog "
26
+ "k8s.io/klog "
27
27
28
28
auditregv1alpha1 "k8s.io/api/auditregistration/v1alpha1"
29
29
corev1 "k8s.io/api/core/v1"
@@ -88,7 +88,7 @@ func (d *delegate) gracefulShutdown() {
88
88
// based on a shared informer.
89
89
func NewBackend (c * Config ) (audit.Backend , error ) {
90
90
eventBroadcaster := record .NewBroadcaster ()
91
- eventBroadcaster .StartLogging (glog .Infof )
91
+ eventBroadcaster .StartLogging (klog .Infof )
92
92
eventBroadcaster .StartRecordingToSink (c .EventConfig .Sink )
93
93
94
94
scheme := runtime .NewScheme ()
@@ -139,12 +139,12 @@ func NewBackend(c *Config) (audit.Backend, error) {
139
139
if ! ok {
140
140
tombstone , ok := obj .(cache.DeletedFinalStateUnknown )
141
141
if ! ok {
142
- glog .V (2 ).Infof ("Couldn't get object from tombstone %#v" , obj )
142
+ klog .V (2 ).Infof ("Couldn't get object from tombstone %#v" , obj )
143
143
return
144
144
}
145
145
sink , ok = tombstone .Obj .(* auditregv1alpha1.AuditSink )
146
146
if ! ok {
147
- glog .V (2 ).Infof ("Tombstone contained object that is not an AuditSink: %#v" , obj )
147
+ klog .V (2 ).Infof ("Tombstone contained object that is not an AuditSink: %#v" , obj )
148
148
return
149
149
}
150
150
}
@@ -235,20 +235,20 @@ func (b *backend) addSink(sink *auditregv1alpha1.AuditSink) {
235
235
defer b .delegateUpdateMutex .Unlock ()
236
236
delegates := b .copyDelegates ()
237
237
if _ , ok := delegates [sink .UID ]; ok {
238
- glog .Errorf ("Audit sink %q uid: %s already exists, could not readd" , sink .Name , sink .UID )
238
+ klog .Errorf ("Audit sink %q uid: %s already exists, could not readd" , sink .Name , sink .UID )
239
239
return
240
240
}
241
241
d , err := b .createAndStartDelegate (sink )
242
242
if err != nil {
243
243
msg := fmt .Sprintf ("Could not add audit sink %q: %v" , sink .Name , err )
244
- glog .Error (msg )
244
+ klog .Error (msg )
245
245
b .recorder .Event (sink , corev1 .EventTypeWarning , "CreateFailed" , msg )
246
246
return
247
247
}
248
248
delegates [sink .UID ] = d
249
249
b .setDelegates (delegates )
250
- glog .V (2 ).Infof ("Added audit sink: %s" , sink .Name )
251
- glog .V (2 ).Infof ("Current audit sinks: %v" , delegates .Names ())
250
+ klog .V (2 ).Infof ("Added audit sink: %s" , sink .Name )
251
+ klog .V (2 ).Infof ("Current audit sinks: %v" , delegates .Names ())
252
252
}
253
253
254
254
// updateSink is called by the shared informer when a sink is updated.
@@ -261,7 +261,7 @@ func (b *backend) updateSink(oldSink, newSink *auditregv1alpha1.AuditSink) {
261
261
delegates := b .copyDelegates ()
262
262
oldDelegate , ok := delegates [oldSink .UID ]
263
263
if ! ok {
264
- glog .Errorf ("Could not update audit sink %q uid: %s, old sink does not exist" ,
264
+ klog .Errorf ("Could not update audit sink %q uid: %s, old sink does not exist" ,
265
265
oldSink .Name , oldSink .UID )
266
266
return
267
267
}
@@ -276,7 +276,7 @@ func (b *backend) updateSink(oldSink, newSink *auditregv1alpha1.AuditSink) {
276
276
d , err := b .createAndStartDelegate (newSink )
277
277
if err != nil {
278
278
msg := fmt .Sprintf ("Could not update audit sink %q: %v" , oldSink .Name , err )
279
- glog .Error (msg )
279
+ klog .Error (msg )
280
280
b .recorder .Event (newSink , corev1 .EventTypeWarning , "UpdateFailed" , msg )
281
281
return
282
282
}
@@ -286,8 +286,8 @@ func (b *backend) updateSink(oldSink, newSink *auditregv1alpha1.AuditSink) {
286
286
oldDelegate .gracefulShutdown ()
287
287
}
288
288
289
- glog .V (2 ).Infof ("Updated audit sink: %s" , newSink .Name )
290
- glog .V (2 ).Infof ("Current audit sinks: %v" , delegates .Names ())
289
+ klog .V (2 ).Infof ("Updated audit sink: %s" , newSink .Name )
290
+ klog .V (2 ).Infof ("Current audit sinks: %v" , delegates .Names ())
291
291
}
292
292
293
293
// deleteSink is called by the shared informer when a sink is deleted
@@ -297,14 +297,14 @@ func (b *backend) deleteSink(sink *auditregv1alpha1.AuditSink) {
297
297
delegates := b .copyDelegates ()
298
298
delegate , ok := delegates [sink .UID ]
299
299
if ! ok {
300
- glog .Errorf ("Could not delete audit sink %q uid: %s, does not exist" , sink .Name , sink .UID )
300
+ klog .Errorf ("Could not delete audit sink %q uid: %s, does not exist" , sink .Name , sink .UID )
301
301
return
302
302
}
303
303
delete (delegates , sink .UID )
304
304
b .setDelegates (delegates )
305
305
delegate .gracefulShutdown ()
306
- glog .V (2 ).Infof ("Deleted audit sink: %s" , sink .Name )
307
- glog .V (2 ).Infof ("Current audit sinks: %v" , delegates .Names ())
306
+ klog .V (2 ).Infof ("Deleted audit sink: %s" , sink .Name )
307
+ klog .V (2 ).Infof ("Current audit sinks: %v" , delegates .Names ())
308
308
}
309
309
310
310
// createAndStartDelegate will build a delegate from an audit sink configuration and run it
0 commit comments