Add subchart-safe helpers so consumers can reference substrate resources by name#18
Merged
EItanya merged 1 commit intoJul 6, 2026
Conversation
Consumers of the substrate chart as a subchart (e.g. kagent) need to
reference release-name-prefixed resource names — the ate-api-server
ServiceAccount for RBAC bindings, and the ateapi + atenet-router Service
DNS names for controller env vars. Previously each consumer had to know
the fullname prefixing scheme and manually override defaults; kagent's
recent 0.0.8 bump had to set controller.substrate.ateApiServer.serviceAccount
by hand because the built-in default "ate-api-server" is the standalone-render
name, not the actual "<release>-ate-api-server" the chart creates.
Two changes:
1. Fix substrate.fullname to be context-safe. Previously it compared
$ctx.Release.Name against $ctx.Chart.Name; when called from a parent
chart's template, $ctx.Chart.Name resolves to the parent chart
("kagent"), so with release=kagent the helper returned the bare
(unprefixed) name — the opposite of what the subchart itself
renders. Compare against the literal "substrate" instead. The
hack/render-manifests.sh path (release=substrate) is unaffected.
2. Add three named helpers for the resource references consumers most
often need:
substrate.ateApiServer.serviceAccountName
substrate.ateApi.endpoint
substrate.atenetRouter.url
Parent charts can `include` these instead of duplicating the naming
scheme. Verified via a probe subchart install: with release=kagent
they resolve to kagent-ate-api-server, dns:///kagent-api.ate-system.svc:443,
and http://kagent-atenet-router.ate-system.svc:80 respectively.
hack/render-manifests.sh --check still passes.
EItanya
approved these changes
Jul 6, 2026
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.
Summary
Consumers of this chart as a subchart (e.g.
kagent-dev/kagent) need to reference release-name-prefixed resource names — the ate-api-server ServiceAccount for tenant-namespace RBAC bindings, and the ateapi / atenet-router Service DNS names for controller env vars. Previously each consumer had to know the fullname prefixing scheme and hard-code its own defaults; the recent kagent 0.0.8 substrate bump had to setcontroller.substrate.ateApiServer.serviceAccountby hand because kagent's defaultate-api-serveris the standalone-render name, not the<release>-ate-api-serverthis chart actually creates.Two changes to
charts/substrate/templates/_helpers.tpl:1. Make
substrate.fullnamecontext-safe. It previously compared$ctx.Release.Name == $ctx.Chart.Name. When called from a parent chart's template,$ctx.Chart.Nameresolves to the parent chart ("kagent"), so withrelease=kagentthe helper returned the bare unprefixed name — the opposite of what this subchart's own templates render. Compare against the literal"substrate"instead. Thehack/render-manifests.shpath (release=substrate) is unaffected, andhack/render-manifests.sh --checkstill passes.2. Add three named helpers that wrap the naming scheme so consumers don't need to know it:
substrate.ateApiServer.serviceAccountName<release>-ate-api-serversubstrate.ateApi.endpointdns:///<release>-api.<namespace>.svc:443substrate.atenetRouter.urlhttp://<release>-atenet-router.<namespace>.svc:80Parent charts can then drop bare-name defaults and use e.g.
The atenet-router and ateapi Services have the same subchart-prefix problem as the SA — this PR unblocks fixing all three in one downstream change.
Test plan
hack/render-manifests.sh --check—manifests/ate-install/unchangedhelm template substrate charts/substrate— bare names preservedhelm template kagent charts/substrate— resources render askagent-*(unchanged)charts/substrateinto a scratch parent chart and confirmed the three named helpers resolve tokagent-ate-api-server,dns:///kagent-api.<ns>.svc:443,http://kagent-atenet-router.<ns>.svc:80when invoked from parent-chart context withrelease=kagentkagent-dev/kagent'scontroller-deployment.yamlandsubstrate-ate-api-rbac.yamlto default from these helpers, dropping the manual overrides currently required.