Skip to content

Commit c354051

Browse files
sebastianiv21claude
andcommitted
fix(helm): make redisMasterHost self-contained so unittest CI passes
The previous version called common.names.fullname via .Subcharts.redis. That template is only registered when the redis subchart is built into charts/, but `helm unittest` (CI) renders the parent chart without dependencies — so every test that renders deployment.yaml failed with `no template "common.names.fullname"`. Re-implement the subchart's fullname algorithm inline (pinned to redis-16.11.2's common library): fullnameOverride wins, else {release}-{nameOverride|"redis"} with the "release name contains redis" collapse and trunc 63. No subchart dependency, identical output — verified with charts/ removed (CI condition) and against the rendered master Service name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c659b7b commit c354051

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

deploy/helm/templates/_helpers.tpl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,23 @@ every `helm template`/install/upgrade.
260260

261261
{{/*
262262
Redis: master service hostname (FQDN inside the cluster).
263-
Reuses the bundled `common.names.fullname` helper (the one the subchart's master
264-
Service uses), evaluated in the redis subchart's context (.Subcharts.redis), so the
265-
host always matches the Service it renders — including the edge cases where the
263+
Mirrors the Bitnami subchart's own `common.names.fullname` algorithm so the host
264+
always matches the master Service it renders — including the edge cases where the
266265
release name contains "redis" (the subchart collapses its fullname to just the
267266
release name) or redis.nameOverride / redis.fullnameOverride is set.
268-
Only valid when redis.enabled (the subchart context exists); all callers gate on it.
267+
268+
Re-implemented here rather than calling `common.names.fullname` directly: that
269+
template is only registered when the redis subchart is built into charts/, which
270+
is not the case under `helm unittest` (it renders the parent chart without
271+
dependencies). Logic is pinned to redis-16.11.2's common library; revisit if the
272+
subchart is bumped.
269273
*/}}
274+
{{- define "appsmith.redisFullname" -}}
275+
{{- $name := default "redis" .Values.redis.nameOverride -}}
276+
{{- .Values.redis.fullnameOverride | default (ternary .Release.Name (printf "%s-%s" .Release.Name $name) (contains $name .Release.Name)) | trunc 63 | trimSuffix "-" -}}
277+
{{- end -}}
270278
{{- define "appsmith.redisMasterHost" -}}
271-
{{- printf "%s-master.%s.svc.cluster.local" (include "common.names.fullname" .Subcharts.redis) (include "appsmith.namespace" .) -}}
279+
{{- printf "%s-master.%s.svc.cluster.local" (include "appsmith.redisFullname" .) (include "appsmith.namespace" .) -}}
272280
{{- end -}}
273281

274282
{{/*

0 commit comments

Comments
 (0)