Skip to content

Commit

Permalink
Fixing issue with non-existant .Template when using tpl function
Browse files Browse the repository at this point in the history
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 <matt.farina@suse.com>
(cherry picked from commit f895948)
  • Loading branch information
mattfarina committed Aug 31, 2021
1 parent 548fae1 commit 4a7c306
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<no value>" even if Options(missing=zero)
// is set. Since missing=error will never get here, we do not need to handle
Expand Down

0 comments on commit 4a7c306

Please sign in to comment.