From eb3a4b84cdb45042ea4f4a299f179a55f6292149 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Mon, 11 Sep 2023 13:42:04 +0200 Subject: [PATCH] runner: address regression in captured Helm logs This addresses a regression in the Helm log capturing introduced in 3b25041385934e6ba7fc8e2eabf9ea17cd9d9474, 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 --- internal/runner/runner.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index be0bd355a..0488054f1 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -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 }