Helm falls back to the "default" namespace when --namespace is omitted, so a forgotten flag (or a Kustomize helmCharts entry without namespace) silently deployed into the wrong place. Render the namespace through one helper that fails on an empty or implicit "default" namespace, with allowDefaultNamespace as an explicit opt-in. scripts/check-chart.sh lints the chart, asserts every namespaced resource carries the passed namespace, and checks both failure and opt-in paths. CI runs it instead of the plain template call. Bump the chart to 0.2.1.
53 lines
2.0 KiB
Smarty
53 lines
2.0 KiB
Smarty
{{- define "audiomanager.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{- define "audiomanager.fullname" -}}
|
|
{{- if .Values.fullnameOverride -}}
|
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
{{- if contains $name .Release.Name -}}
|
|
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- define "audiomanager.labels" -}}
|
|
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" }}
|
|
app.kubernetes.io/name: {{ include "audiomanager.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end -}}
|
|
|
|
{{- define "audiomanager.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "audiomanager.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end -}}
|
|
|
|
{{- define "audiomanager.image" -}}
|
|
{{- printf "%s:%s" .Values.image.repository (default .Chart.AppVersion .Values.image.tag) -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
The namespace every resource is rendered into.
|
|
|
|
Helm falls back to "default" when --namespace is omitted, which would silently
|
|
put the release somewhere the operator did not ask for. Refuse to render in
|
|
that case unless the fallback is explicitly allowed, so a forgotten --namespace
|
|
(or a kustomization without namespace:) fails instead of deploying.
|
|
*/}}
|
|
{{- define "audiomanager.namespace" -}}
|
|
{{- $namespace := .Release.Namespace -}}
|
|
{{- if not $namespace -}}
|
|
{{- fail "a namespace is required: pass --namespace <namespace> (or set namespace: in the Kustomize helmCharts entry)" -}}
|
|
{{- end -}}
|
|
{{- if and (eq $namespace "default") (not .Values.allowDefaultNamespace) -}}
|
|
{{- fail "refusing to deploy into the implicit \"default\" namespace: pass --namespace <namespace>, or set allowDefaultNamespace=true to opt in" -}}
|
|
{{- end -}}
|
|
{{- $namespace -}}
|
|
{{- end -}}
|