Skip to content

Commit eb3a4b8

Browse files
committed
runner: address regression in captured Helm logs
This addresses a regression in the Helm log capturing introduced in 3b25041, which prevented valuable information from the Kube client logs (e.g. the specific reason for a timeout) to be added to the event emitted in case of a failure. Signed-off-by: Hidde Beydals <hidde@hhh.computer>
1 parent 394ab5a commit eb3a4b8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/runner/runner.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,22 @@ func NewRunner(getter genericclioptions.RESTClientGetter, storageNamespace strin
7878
runner := &Runner{
7979
logBuffer: NewLogBuffer(NewDebugLog(logger.V(runtimelogger.DebugLevel)), defaultBufferSize),
8080
}
81+
82+
// Default to the trace level logger for the Helm action configuration,
83+
// to ensure storage logs are captured.
8184
cfg := new(action.Configuration)
8285
if err := cfg.Init(getter, storageNamespace, "secret", NewDebugLog(logger.V(runtimelogger.TraceLevel))); err != nil {
8386
return nil, err
8487
}
85-
// Override the logger used by the Helm actions with the log buffer.
88+
89+
// Override the logger used by the Helm actions and Kube client with the log buffer,
90+
// which provides useful information in the event of an error.
8691
cfg.Log = runner.logBuffer.Log
92+
if kc, ok := cfg.KubeClient.(*kube.Client); ok {
93+
kc.Log = runner.logBuffer.Log
94+
}
8795
runner.config = cfg
96+
8897
return runner, nil
8998
}
9099

0 commit comments

Comments
 (0)