Files
it_cost_dashboard/helm/templates/_helpers.tpl
T
2026-09-11 10:11:09 +08:00

57 lines
2.0 KiB
Smarty

{{/* Chart name, overridable. */}}
{{- define "it-cost-dashboard.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Fully qualified app name. Kept short: it prefixes the StatefulSet name, which
in turn prefixes pod names and the generated PVC names.
*/}}
{{- define "it-cost-dashboard.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- define "it-cost-dashboard.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/* Labels applied to every object. */}}
{{- define "it-cost-dashboard.labels" -}}
helm.sh/chart: {{ include "it-cost-dashboard.chart" . }}
{{ include "it-cost-dashboard.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "it-cost-dashboard.selectorLabels" -}}
app.kubernetes.io/name: {{ include "it-cost-dashboard.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Component-scoped labels. The workflow's rollout-restart selects on
app.kubernetes.io/component=server so it does not bounce MySQL.
Usage: {{ include "it-cost-dashboard.componentLabels" (dict "ctx" . "component" "server") }}
*/}}
{{- define "it-cost-dashboard.componentLabels" -}}
{{ include "it-cost-dashboard.labels" .ctx }}
app.kubernetes.io/component: {{ .component }}
{{- end }}
{{- define "it-cost-dashboard.componentSelectorLabels" -}}
{{ include "it-cost-dashboard.selectorLabels" .ctx }}
app.kubernetes.io/component: {{ .component }}
{{- end }}
{{/* ClusterIP Service name for MySQL — the DATABASE_URL host and the
wait-for-db initContainer target. */}}
{{- define "it-cost-dashboard.dbServiceName" -}}
{{- printf "%s-db" (include "it-cost-dashboard.fullname" .) }}
{{- end }}