fix(helm): use root context $ in tpl() inside with blocks#744
Merged
Cali0707 merged 2 commits intoFeb 5, 2026
Merged
Conversation
Inside {{- with .Values.xxx }}, the dot . is the current value (e.g. array
or nested object). Using tpl (toYaml .) . passes that value as the template
context, but tpl expects the root context (chartutil.Values). This causes
'wrong type for value; expected chartutil.Values; got []interface {}' when
imagePullSecrets, livenessProbe, readinessProbe, etc. are set.
Use the root context $ as the second argument to tpl wherever it is used
inside a with block, so template expressions in the YAML string are
evaluated against the full chart context. The tpl (toYaml (default ...)) .
usages outside with blocks are left unchanged.
Signed-off-by: sh.yoon <sh.yoon.devops@gmail.com>
manusa
force-pushed
the
fix/helm-tpl-context-in-with-blocks
branch
from
February 5, 2026 15:36
550d996 to
09779d1
Compare
The same issue fixed in deployment.yaml also exists in serviceaccount.yaml: using tpl (toYaml .) . inside a with block fails when the value contains template expressions, because . refers to the current value instead of the root chart context. This commit: - Changes . to $ in serviceaccount.yaml tpl call - Adds serviceAccount.annotations test case to ci/tpl-test-values.yaml Signed-off-by: Marc Nuri <marc@marcnuri.com>
manusa
force-pushed
the
fix/helm-tpl-context-in-with-blocks
branch
from
February 5, 2026 15:42
9fdd5b8 to
73a2e29
Compare
manusa
approved these changes
Feb 5, 2026
manusa
left a comment
Member
There was a problem hiding this comment.
LGTM, thx!
I rebased on top of main to have the checks provided in the pipeline implemented in #745
Also added another fix for serviceaccount.yaml that was missing.
We should merge this ASAP to avoid having a failing pipeline on main.
Cali0707
approved these changes
Feb 5, 2026
Cali0707
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @shyoon-devops @manusa !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #743
Problem
Inside
{{- with .Values.xxx }}, the dot.is the current value (e.g. array or nested object). Usingtpl (toYaml .) .passes that value as the template context, buttplexpects the root context (chartutil.Values). This causes:wrong type for value; expected chartutil.Values; got []interface {}when e.g.imagePullSecretsis setlivenessProbe,readinessProbe, etc. when default values are renderedSolution
Use the root context
$as the second argument totplwherever it is used inside awithblock, so that any template expressions in the YAML string are evaluated against the full chart context.Change: Replace all occurrences of
tpl (toYaml .) .withtpl (toYaml .) $incharts/kubernetes-mcp-server/templates/deployment.yaml(only in the lines that are inside{{- with ... }}blocks).Lines updated (inside
withblocks):The existing
tpl (toYaml (default ...)) .usages that are outsidewithblocks are left unchanged (.is correct there).