mirror of
https://github.com/Sudo-JHare/FHIRFLARE-IG-Toolkit.git
synced 2025-09-17 18:35:02 +00:00
152 lines
4.9 KiB
Smarty
152 lines
4.9 KiB
Smarty
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "fhirflare-ig-toolkit.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create a default fully qualified app name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
If release name contains chart name it will be used as a full name.
|
|
*/}}
|
|
{{- define "fhirflare-ig-toolkit.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 "fhirflare-ig-toolkit.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Common labels
|
|
*/}}
|
|
{{- define "fhirflare-ig-toolkit.labels" -}}
|
|
helm.sh/chart: {{ include "fhirflare-ig-toolkit.chart" . }}
|
|
{{ include "fhirflare-ig-toolkit.selectorLabels" . }}
|
|
{{- if .Chart.AppVersion }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
{{- end }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Selector labels
|
|
*/}}
|
|
{{- define "fhirflare-ig-toolkit.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "fhirflare-ig-toolkit.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the name of the service account to use
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.serviceAccountName" -}}
|
|
{{- if .Values.serviceAccount.create }}
|
|
{{- default (include "hapi-fhir-jpaserver.fullname" .) .Values.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create a default fully qualified postgresql name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.postgresql.fullname" -}}
|
|
{{- $name := default "postgresql" .Values.postgresql.nameOverride -}}
|
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Get the Postgresql credentials secret name.
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.postgresql.secretName" -}}
|
|
{{- if .Values.postgresql.enabled -}}
|
|
{{- if .Values.postgresql.auth.existingSecret -}}
|
|
{{- printf "%s" .Values.postgresql.auth.existingSecret -}}
|
|
{{- else -}}
|
|
{{- printf "%s" (include "hapi-fhir-jpaserver.postgresql.fullname" .) -}}
|
|
{{- end -}}
|
|
{{- else }}
|
|
{{- if .Values.externalDatabase.existingSecret -}}
|
|
{{- printf "%s" .Values.externalDatabase.existingSecret -}}
|
|
{{- else -}}
|
|
{{ printf "%s-%s" (include "hapi-fhir-jpaserver.fullname" .) "external-db" }}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Get the Postgresql credentials secret key.
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.postgresql.secretKey" -}}
|
|
{{- if .Values.postgresql.enabled -}}
|
|
{{- if .Values.postgresql.auth.username -}}
|
|
{{- printf "%s" .Values.postgresql.auth.secretKeys.userPasswordKey -}}
|
|
{{- else -}}
|
|
{{- printf "%s" .Values.postgresql.auth.secretKeys.adminPasswordKey -}}
|
|
{{- end -}}
|
|
{{- else }}
|
|
{{- if .Values.externalDatabase.existingSecret -}}
|
|
{{- printf "%s" .Values.externalDatabase.existingSecretKey -}}
|
|
{{- else -}}
|
|
{{- printf "postgres-password" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Add environment variables to configure database values
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.database.host" -}}
|
|
{{- ternary (include "hapi-fhir-jpaserver.postgresql.fullname" .) .Values.externalDatabase.host .Values.postgresql.enabled -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Add environment variables to configure database values
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.database.user" -}}
|
|
{{- if .Values.postgresql.enabled -}}
|
|
{{- printf "%s" .Values.postgresql.auth.username | default "postgres" -}}
|
|
{{- else -}}
|
|
{{- printf "%s" .Values.externalDatabase.user -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Add environment variables to configure database values
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.database.name" -}}
|
|
{{- ternary .Values.postgresql.auth.database .Values.externalDatabase.database .Values.postgresql.enabled -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Add environment variables to configure database values
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.database.port" -}}
|
|
{{- ternary "5432" .Values.externalDatabase.port .Values.postgresql.enabled -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create the JDBC URL from the host, port and database name.
|
|
*/}}
|
|
{{- define "hapi-fhir-jpaserver.database.jdbcUrl" -}}
|
|
{{- $host := (include "hapi-fhir-jpaserver.database.host" .) -}}
|
|
{{- $port := (include "hapi-fhir-jpaserver.database.port" .) -}}
|
|
{{- $name := (include "hapi-fhir-jpaserver.database.name" .) -}}
|
|
{{- $appName := .Release.Name -}}
|
|
{{ printf "jdbc:postgresql://%s:%d/%s?ApplicationName=%s" $host (int $port) $name $appName }}
|
|
{{- end -}} |