2022-05-17 14:38:47 +02:00
|
|
|
{{/*
|
|
|
|
Expand the name of the chart.
|
|
|
|
*/}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- define "fcoscore.name" -}}
|
2022-05-17 14:38:47 +02:00
|
|
|
{{- 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.
|
|
|
|
*/}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- define "fcoscore.fullname" -}}
|
2022-05-17 14:38:47 +02:00
|
|
|
{{- 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.
|
|
|
|
*/}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- define "fcoscore.chart" -}}
|
2022-05-17 14:38:47 +02:00
|
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Common labels
|
|
|
|
*/}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- define "fcoscore.labels" -}}
|
|
|
|
helm.sh/chart: {{ include "fcoscore.chart" . }}
|
|
|
|
{{ include "fcoscore.selectorLabels" . }}
|
2022-05-17 14:38:47 +02:00
|
|
|
{{- if .Chart.AppVersion }}
|
|
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
|
|
{{- end }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Selector labels
|
|
|
|
*/}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- define "fcoscore.selectorLabels" -}}
|
|
|
|
app.kubernetes.io/name: {{ include "fcoscore.name" . }}
|
2022-05-17 14:38:47 +02:00
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create the name of the service account to use
|
|
|
|
*/}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- define "fcoscore.serviceAccountName" -}}
|
2022-05-17 14:38:47 +02:00
|
|
|
{{- if .Values.serviceAccount.create }}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- default (include "fcoscore.fullname" .) .Values.serviceAccount.name }}
|
2022-05-17 14:38:47 +02:00
|
|
|
{{- else }}
|
|
|
|
{{- default "default" .Values.serviceAccount.name }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2022-06-22 17:44:49 +02:00
|
|
|
|
|
|
|
{{/*
|
|
|
|
Get the user defined LoadBalancerIP for this release
|
|
|
|
Note, returns 127.0.0.1 if using ClusterIP.
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.serviceIP" -}}
|
|
|
|
{{- if eq .Values.service.type "ClusterIP" -}}
|
|
|
|
127.0.0.1
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Values.service.loadBalancerIP | default "" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Gets the host to be used for this application.
|
|
|
|
If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.host" -}}
|
|
|
|
{{- if .Values.ingress.enabled }}
|
|
|
|
{{- $host := .Values.ingress.hostname | default "" -}}
|
|
|
|
{{- default (include "fcoscore.serviceIP" .) $host -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $host := .Values.host | default "" -}}
|
|
|
|
{{- default (include "fcoscore.serviceIP" .) $host -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
2022-11-10 17:23:06 +01:00
|
|
|
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.
|
2022-06-22 17:44:49 +02:00
|
|
|
*/}}
|
2022-11-10 17:23:06 +01:00
|
|
|
{{- define "fcoscore.zenflow.fullname" -}}
|
|
|
|
{{- printf "%s-zenflow" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "fcoscore.zenflow.host" -}}
|
|
|
|
{{- printf "%s" (include "fcoscore.zenflow.fullname" . ) -}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- end -}}
|
2022-11-10 17:23:06 +01:00
|
|
|
|
|
|
|
{{- define "fcoscore.zenflow.port" -}}
|
|
|
|
{{- .Values.zvmlet.service.port -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "fcoscore.zenflow.url" -}}
|
|
|
|
{{- printf "http://%s:%s" (include "fcoscore.zenflow.host" . ) (include "fcoscore.zenflow.port" . ) -}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
2022-11-10 17:23:06 +01:00
|
|
|
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 "fcoscore.zvmlet.fullname" -}}
|
|
|
|
{{- printf "%s-zvmlet" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "fcoscore.zvmlet.host" -}}
|
|
|
|
{{- printf "%s" (include "fcoscore.zvmlet.fullname" . ) -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "fcoscore.zvmlet.port" -}}
|
|
|
|
{{- .Values.zvmlet.service.port | quote -}}
|
|
|
|
{{- 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.
|
2022-06-22 17:44:49 +02:00
|
|
|
*/}}
|
2022-11-10 17:23:06 +01:00
|
|
|
{{- define "fcoscore.frontend.fullname" -}}
|
|
|
|
{{- printf "%s-frontend" (include "common.names.fullname" .) | 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 "fcoscore.gateway.fullname" -}}
|
|
|
|
{{- printf "%s-gateway" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "fcoscore.gateway.host" -}}
|
|
|
|
{{- printf "%s" (include "fcoscore.gateway.fullname" . ) -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "fcoscore.gateway.port" -}}
|
2022-11-16 17:50:45 +01:00
|
|
|
{{- .Values.gateway.service.port -}}
|
2022-11-10 17:23:06 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "fcoscore.gateway.url" -}}
|
2022-11-30 10:08:26 +01:00
|
|
|
{{- if .Values.gateway.url }}
|
|
|
|
{{- .Values.gateway.url -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- print "gateway.example.org" -}}
|
|
|
|
{{- end -}}
|
2022-11-10 17:23:06 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2023-02-13 16:45:57 +01:00
|
|
|
|
|
|
|
{{/*
|
|
|
|
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 "fcoscore.inbox.fullname" -}}
|
|
|
|
{{- printf "%s-inbox" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "fcoscore.inbox.port" -}}
|
|
|
|
{{- .Values.inbox.service.port | quote -}}
|
|
|
|
{{- 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 "fcoscore.tarantool.fullname" -}}
|
|
|
|
{{- printf "%s-tarantool" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "fcoscore.tarantool.port" -}}
|
|
|
|
{{- .Values.tarantool.service.port -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "fcoscore.tarantool.host" -}}
|
|
|
|
{{- printf "%s:%s" (include "fcoscore.tarantool.fullname" . ) ( include "fcoscore.tarantool.port" . ) -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-11-10 17:23:06 +01:00
|
|
|
{{/*
|
|
|
|
Return the Fab City Core secret name
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.secretName" -}}
|
2022-06-22 17:44:49 +02:00
|
|
|
{{- default (include "common.names.fullname" .) -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-11-10 17:23:06 +01:00
|
|
|
{{/*
|
|
|
|
Return true if a secret object for FabCityOS should be created
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.createSecret" -}}
|
|
|
|
{{- if or (and .Values.smtp.enabled .Values.smtp.password (not .Values.smtp.existingSecret)) }}
|
|
|
|
{{- true -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-06-22 17:44:49 +02:00
|
|
|
{{/*
|
|
|
|
Return the Postgresql hostname
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.database.host" -}}
|
|
|
|
{{- ternary (include "fcoscore.postgresql.fullname" .) .Values.externalDatabase.host .Values.postgresql.enabled | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the Postgresql port
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.database.port" -}}
|
|
|
|
{{- ternary "5432" .Values.externalDatabase.port .Values.postgresql.enabled | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the Postgresql database name
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.database.name" -}}
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
{{- if .Values.global.postgresql }}
|
|
|
|
{{- if .Values.global.postgresql.auth }}
|
|
|
|
{{- coalesce .Values.global.postgresql.auth.database .Values.postgresql.auth.database | quote -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Values.postgresql.auth.database | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Values.postgresql.auth.database | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Values.externalDatabase.database | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the Postgresql user
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.database.user" -}}
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
{{- if .Values.global.postgresql }}
|
|
|
|
{{- if .Values.global.postgresql.auth }}
|
|
|
|
{{- coalesce .Values.global.postgresql.auth.username .Values.postgresql.auth.username | quote -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Values.postgresql.auth.username | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Values.postgresql.auth.username | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Values.externalDatabase.user | quote -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the Postgresql secret name
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.database.secretName" -}}
|
|
|
|
{{- if .Values.postgresql.enabled }}
|
|
|
|
{{- if .Values.global.postgresql }}
|
|
|
|
{{- if .Values.global.postgresql.auth }}
|
|
|
|
{{- if .Values.global.postgresql.auth.existingSecret }}
|
|
|
|
{{- tpl .Values.global.postgresql.auth.existingSecret $ -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- default (include "fcoscore.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- default (include "fcoscore.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- default (include "fcoscore.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- default (printf "%s-database" .Release.Name) (tpl .Values.externalDatabase.existingSecret $) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the Postgresql password secret key
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.database.secretPasswordKey" -}}
|
|
|
|
{{- if .Values.postgresql.enabled -}}
|
|
|
|
{{- print "password" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- if .Values.externalDatabase.existingSecret -}}
|
|
|
|
{{- default "password" .Values.externalDatabase.existingSecretPasswordKey }}
|
|
|
|
{{- else -}}
|
|
|
|
{{- print "password" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the Postgresql postgres password secret key
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.database.secretPostgresPasswordKey" -}}
|
|
|
|
{{- if .Values.postgresql.enabled -}}
|
|
|
|
{{- print "postgres-password" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- if .Values.externalDatabase.existingSecret -}}
|
|
|
|
{{- default "postgres-password" .Values.externalDatabase.existingSecretPostgresPasswordKey }}
|
|
|
|
{{- else -}}
|
|
|
|
{{- print "postgres-password" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2022-11-10 17:23:06 +01:00
|
|
|
{{- define "fcoscore.meilisearch.host" -}}
|
|
|
|
{{- include "common.names.dependency.fullname" (dict "chartName" "meilisearch" "chartValues" .Values.meilisearch "context" $) -}}
|
|
|
|
{{- end }}
|
|
|
|
|
2022-06-22 17:44:49 +02:00
|
|
|
{{/*
|
|
|
|
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).
|
|
|
|
*/}}
|
|
|
|
{{- define "fcoscore.postgresql.fullname" -}}
|
|
|
|
{{- include "common.names.dependency.fullname" (dict "chartName" "postgresql" "chartValues" .Values.postgresql "context" $) -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "fcoscore.meilisearch.port" -}}
|
|
|
|
{{- .Values.meilisearch.service.port -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "fcoscore.meilisearch.url" -}}
|
|
|
|
{{- printf "http://%s:%s" (include "fcoscore.meilisearch.host" . ) (include "fcoscore.meilisearch.port" . ) -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return the FabCityOS SMTP secret name
|
|
|
|
*/}}
|
|
|
|
{{- define "smtp.secretName" -}}
|
|
|
|
{{- default (printf "%s" (include "common.names.fullname" .)) (tpl .Values.smtp.existingSecret $) -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Return true if FabCityOS SMTP uses password authentication
|
|
|
|
*/}}
|
|
|
|
{{- define "smtp.password.enabled" -}}
|
|
|
|
{{- if and .Values.smtp.enabled (or .Values.smtp.password .Values.smtp.existingSecret) }}
|
|
|
|
{{- true -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2022-10-25 13:38:56 +02:00
|
|
|
|
|
|
|
{{- /*
|
|
|
|
Returns given number of random Hex characters.
|
|
|
|
- randNumeric 4 | atoi generates a random number in [0, 10^4)
|
|
|
|
This is a range range evenly divisble by 16, but even if off by one,
|
|
|
|
that last partial interval offsetting randomness is only 1 part in 625.
|
|
|
|
- mod N 16 maps to the range 0-15
|
|
|
|
- printf "%x" represents a single number 0-15 as a single hex character
|
|
|
|
*/}}
|
|
|
|
{{- define "randHex" -}}
|
|
|
|
{{- $result := "" }}
|
|
|
|
{{- range $i := until . }}
|
|
|
|
{{- $rand_hex_char := mod (randNumeric 4 | atoi) 16 | printf "%x" }}
|
|
|
|
{{- $result = print $result $rand_hex_char }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $result }}
|
|
|
|
{{- end }}
|