From b696c316948dbef2250a8fa4c74e1f0bc0df229e Mon Sep 17 00:00:00 2001 From: Ogulcan Aydogan Date: Thu, 17 Sep 2026 21:29:12 +0100 Subject: [PATCH] fix(engine): add debug logging to the no-cluster lookup placeholder The lookup function has two implementations: a real one backed by a Kubernetes client, and a placeholder that always returns empty and is used whenever there is no cluster connection (the default for plain helm template, without --validate or --dry-run=server). The earlier fix for issue 32101 only added logging to the real implementation, so plain helm template --debug, which is the common case, still silently returned empty with no indication why. Add the same kind of debug log to the placeholder. Signed-off-by: Ogulcan Aydogan --- pkg/engine/funcs.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/engine/funcs.go b/pkg/engine/funcs.go index e876df6c0..adf64f0a4 100644 --- a/pkg/engine/funcs.go +++ b/pkg/engine/funcs.go @@ -21,6 +21,7 @@ import ( "encoding/json" "errors" "fmt" + "log/slog" "maps" "math" "reflect" @@ -88,8 +89,16 @@ func funcMap() template.FuncMap { "tpl": func(string, any) any { return "not implemented" }, "required": func(string, any) (any, error) { return "not implemented", nil }, // Provide a placeholder for the "lookup" function, which requires a kubernetes - // connection. - "lookup": func(string, string, string, string) (map[string]any, error) { + // connection. This is what actually runs for a plain `helm template` (client-only + // dry run, no cluster connection), which is the common case users hit when they + // expect lookup to see real cluster state and get an empty result instead. + "lookup": func(apiversion, kind, namespace, name string) (map[string]any, error) { + slog.Debug("lookup: no cluster connection, returning empty result", + slog.String("apiVersion", apiversion), + slog.String("kind", kind), + slog.String("namespace", namespace), + slog.String("name", name), + ) return map[string]any{}, nil }, }