Files
duocthu/infra/helm/medical-chatbot/templates/_helpers.tpl
T

52 lines
2.1 KiB
Smarty

{{- define "medical-chatbot.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "medical-chatbot.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name (include "medical-chatbot.name" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{/*
Container image reference.
The tag is demanded explicitly rather than defaulted so that a values file
which deliberately leaves it unset fails the render instead of silently
inheriting the chart's `local` development tag. Production and practice both
supply an immutable commit SHA per deploy — practice through the ArgoCD
Application's inline values, rewritten by sync_practice_argocd.py and a
chart that guessed a tag here would deploy something nobody asked for.
Usage: {{ include "medical-chatbot.image" (dict "image" .Values.web.image "name" "web") }}
*/}}
{{- define "medical-chatbot.image" -}}
{{- $tag := required (printf "%s.image.tag must be set to an immutable tag (a commit SHA); the chart will not guess one" .name) .image.tag -}}
{{- printf "%s:%s" (required (printf "%s.image.repository must be set" .name) .image.repository) $tag -}}
{{- end -}}
{{- define "medical-chatbot.labels" -}}
app.kubernetes.io/name: {{ include "medical-chatbot.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote }}
{{- end -}}
{{- define "medical-chatbot.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{- default (include "medical-chatbot.fullname" .) .Values.serviceAccount.name -}}
{{- else -}}
{{- default "default" .Values.serviceAccount.name -}}
{{- end -}}
{{- end -}}
{{- define "medical-chatbot.secretName" -}}
{{- if .Values.secret.create -}}
{{- printf "%s-runtime" (include "medical-chatbot.fullname" .) -}}
{{- else -}}
{{- required "secret.existingSecret is required when secret.create=false" .Values.secret.existingSecret -}}
{{- end -}}
{{- end -}}