Skip to content

Commit

Permalink
runner: address regression in captured Helm logs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hiddeco committed Sep 11, 2023
1 parent 394ab5a commit eb3a4b8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,22 @@ func NewRunner(getter genericclioptions.RESTClientGetter, storageNamespace strin
runner := &Runner{
logBuffer: NewLogBuffer(NewDebugLog(logger.V(runtimelogger.DebugLevel)), defaultBufferSize),
}

// Default to the trace level logger for the Helm action configuration,
// to ensure storage logs are captured.
cfg := new(action.Configuration)
if err := cfg.Init(getter, storageNamespace, "secret", NewDebugLog(logger.V(runtimelogger.TraceLevel))); err != nil {
return nil, err
}
// Override the logger used by the Helm actions with the log buffer.

// Override the logger used by the Helm actions and Kube client with the log buffer,
// which provides useful information in the event of an error.
cfg.Log = runner.logBuffer.Log
if kc, ok := cfg.KubeClient.(*kube.Client); ok {
kc.Log = runner.logBuffer.Log
}
runner.config = cfg

return runner, nil
}

Expand Down

0 comments on commit eb3a4b8

Please sign in to comment.