From 4a7c306aa9dcbdeecf79c7517851921a21b72e56 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Tue, 31 Aug 2021 10:19:54 -0400 Subject: [PATCH] Fixing issue with non-existant .Template when using tpl function This is a regression accidently introduced in #9957. A delete call had been used on the Template key of vals. This caused a condition where Template was not available when rendering via tpl. The delete happened after ExecuteTemplate so the issue is surpsising. It may possibly be a race condition. Existing tests did not catch it. I tried to create a test that directly tested the issue and was unable to replicate the error seen with real charts. This leads me to believe it is a race condition in the underlying Go template package. The delete call was not there before #9957. It should be safe to remove and keep that information. Closes #10082 Signed-off-by: Matt Farina (cherry picked from commit f895948ae21e30ef9392201ca4d5f55525cafb62) --- pkg/engine/engine.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index da6263cd8..00494f9d7 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -260,7 +260,6 @@ func (e Engine) renderWithReferences(tpls, referenceTpls map[string]renderable) if err := t.ExecuteTemplate(&buf, filename, vals); err != nil { return map[string]string{}, cleanupExecError(filename, err) } - delete(vals, "Template") // Work around the issue where Go will emit "" even if Options(missing=zero) // is set. Since missing=error will never get here, we do not need to handle