{{/* Expand the name of the chart. */}} {{- define "clawith.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Create a default fully qualified app name. */}} {{- define "clawith.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 }} {{/* Create chart name and version as used by the chart label. */}} {{- define "clawith.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} {{- define "clawith.labels" -}} helm.sh/chart: {{ include "clawith.chart" . }} {{ include "clawith.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{/* Selector labels */}} {{- define "clawith.selectorLabels" -}} app.kubernetes.io/name: {{ include "clawith.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* PostgreSQL host */}} {{- define "clawith.postgresql.host" -}} {{- if .Values.postgresql.enabled }} {{- printf "%s-postgresql" (include "clawith.fullname" .) }} {{- else }} {{- .Values.postgresql.external.host }} {{- end }} {{- end }} {{/* PostgreSQL port */}} {{- define "clawith.postgresql.port" -}} {{- if .Values.postgresql.enabled }} {{- .Values.postgresql.primary.service.port }} {{- else }} {{- .Values.postgresql.external.port }} {{- end }} {{- end }} {{/* PostgreSQL database */}} {{- define "clawith.postgresql.database" -}} {{- if .Values.postgresql.enabled }} {{- .Values.postgresql.auth.database }} {{- else }} {{- .Values.postgresql.external.database }} {{- end }} {{- end }} {{/* PostgreSQL username */}} {{- define "clawith.postgresql.username" -}} {{- if .Values.postgresql.enabled }} {{- .Values.postgresql.auth.username }} {{- else }} {{- .Values.postgresql.external.username }} {{- end }} {{- end }} {{/* PostgreSQL password */}} {{- define "clawith.postgresql.password" -}} {{- if .Values.postgresql.enabled }} {{- .Values.postgresql.auth.password }} {{- else }} {{- .Values.postgresql.external.password }} {{- end }} {{- end }} {{/* Redis host */}} {{- define "clawith.redis.host" -}} {{- if .Values.redis.enabled }} {{- printf "%s-redis" (include "clawith.fullname" .) }} {{- else }} {{- .Values.redis.external.host }} {{- end }} {{- end }} {{/* Redis port */}} {{- define "clawith.redis.port" -}} {{- if .Values.redis.enabled }} {{- .Values.redis.service.port }} {{- else }} {{- .Values.redis.external.port }} {{- end }} {{- end }} {{/* Secret name */}} {{- define "clawith.secretName" -}} {{- if .Values.secrets.create }} {{- printf "%s-secrets" (include "clawith.fullname" .) }} {{- else }} {{- .Values.secrets.existingSecret }} {{- end }} {{- end }}