Skip to content

Commit 56c00ff

Browse files
committed
Logging improvements for debuggability (CD daemon, plugin)
Log claim name on prep for debuggability Standard format is for example used in unprepare: unprepared devices for claim \ 'default/nvbandwidth-test-2-worker-0-compute-domain-channel-mnkrw:67417068-92da-4bbd-803c-ddcbbf0f067f' In prepare, we so far only log by claim UID: prepared devices for claim '67417068-92da-4bbd-803c-ddcbbf0f067f': ... That makes things harder to debug (grepping plugin logs for claim name should work). Also, improve progress report on regular shutdown of the CD daemon.
1 parent afbb033 commit 56c00ff

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmd/compute-domain-daemon/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ func run(ctx context.Context, cancel context.CancelFunc, flags *Flags) error {
244244
klog.Errorf("controller failed, initiate shutdown: %s", err)
245245
cancel()
246246
}
247+
klog.Infof("Terminated: controller task")
247248
}()
248249

249250
// Start IMEX daemon update loop in goroutine (watches for CD status
@@ -264,6 +265,7 @@ func run(ctx context.Context, cancel context.CancelFunc, flags *Flags) error {
264265
cancel()
265266
}
266267
}
268+
klog.Infof("Terminated: IMEX daemon update task")
267269
}()
268270

269271
// Start child process watchdog in goroutine.
@@ -276,11 +278,13 @@ func run(ctx context.Context, cancel context.CancelFunc, flags *Flags) error {
276278
klog.Errorf("watch failed, initiate shutdown: %s", err)
277279
cancel()
278280
}
281+
klog.Infof("Terminated: process manager")
279282
}()
280283

281284
wg.Wait()
282285

283286
// Let's not yet try to make exit code promises.
287+
klog.Infof("Exiting")
284288
return nil
285289
}
286290

cmd/compute-domain-kubelet-plugin/driver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (d *driver) nodePrepareResource(ctx context.Context, claim *resourceapi.Res
245245
devs, err := d.state.Prepare(ctx, claim)
246246
if err != nil {
247247
res := kubeletplugin.PrepareResult{
248-
Err: fmt.Errorf("error preparing devices for claim %v: %w", claim.UID, err),
248+
Err: fmt.Errorf("error preparing devices for claim %s/%s:%s: %w", claim.Namespace, claim.Name, claim.UID, err),
249249
}
250250
if isPermanentError(err) {
251251
klog.V(6).Infof("Permanent error preparing devices for claim %v: %v", claim.UID, err)
@@ -254,7 +254,7 @@ func (d *driver) nodePrepareResource(ctx context.Context, claim *resourceapi.Res
254254
return false, res
255255
}
256256

257-
klog.Infof("Returning newly prepared devices for claim '%v': %v", claim.UID, devs)
257+
klog.Infof("prepared devices for claim '%s/%s:%s': %v", claim.Namespace, claim.Name, claim.UID, devs)
258258
return true, kubeletplugin.PrepareResult{Devices: devs}
259259
}
260260

0 commit comments

Comments
 (0)