You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
5.3 KiB
158 lines
5.3 KiB
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "infisical.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create chart name and version as used by the chart label.
|
|
*/}}
|
|
{{- define "infisical.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create unified labels for infisical components
|
|
*/}}
|
|
{{- define "infisical.common.matchLabels" -}}
|
|
app: {{ template "infisical.name" . }}
|
|
release: {{ .Release.Name }}
|
|
{{- end -}}
|
|
|
|
{{- define "infisical.common.metaLabels" -}}
|
|
chart: {{ template "infisical.chart" . }}
|
|
heritage: {{ .Release.Service }}
|
|
{{- end -}}
|
|
|
|
{{- define "infisical.common.labels" -}}
|
|
{{ include "infisical.common.matchLabels" . }}
|
|
{{ include "infisical.common.metaLabels" . }}
|
|
{{- end -}}
|
|
|
|
|
|
{{- define "infisical.backend.labels" -}}
|
|
{{ include "infisical.backend.matchLabels" . }}
|
|
{{ include "infisical.common.metaLabels" . }}
|
|
{{- end -}}
|
|
|
|
{{- define "infisical.backend.matchLabels" -}}
|
|
component: {{ .Values.backend.name | quote }}
|
|
{{ include "infisical.common.matchLabels" . }}
|
|
{{- end -}}
|
|
|
|
{{- define "infisical.frontend.labels" -}}
|
|
{{ include "infisical.frontend.matchLabels" . }}
|
|
{{ include "infisical.common.metaLabels" . }}
|
|
{{- end -}}
|
|
|
|
{{- define "infisical.frontend.matchLabels" -}}
|
|
component: {{ .Values.frontend.name | quote }}
|
|
{{ include "infisical.common.matchLabels" . }}
|
|
{{- end -}}
|
|
|
|
{{- define "infisical.mongodb.labels" -}}
|
|
{{ include "infisical.mongodb.matchLabels" . }}
|
|
{{ include "infisical.common.metaLabels" . }}
|
|
{{- end -}}
|
|
|
|
{{- define "infisical.mongodb.matchLabels" -}}
|
|
component: {{ .Values.mongodb.name | quote }}
|
|
{{ include "infisical.common.matchLabels" . }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create a fully qualified backend name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
*/}}
|
|
{{- define "infisical.backend.fullname" -}}
|
|
{{- if .Values.backend.fullnameOverride -}}
|
|
{{- .Values.backend.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
{{- if contains $name .Release.Name -}}
|
|
{{- printf "%s-%s" .Release.Name .Values.backend.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- printf "%s-%s-%s" .Release.Name $name .Values.backend.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create a fully qualified frontend name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
*/}}
|
|
{{- define "infisical.frontend.fullname" -}}
|
|
{{- if .Values.frontend.fullnameOverride -}}
|
|
{{- .Values.frontend.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
{{- if contains $name .Release.Name -}}
|
|
{{- printf "%s-%s" .Release.Name .Values.frontend.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- printf "%s-%s-%s" .Release.Name $name .Values.frontend.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create a fully qualified mongodb name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
*/}}
|
|
{{- define "infisical.mongodb.fullname" -}}
|
|
{{- if .Values.mongodb.fullnameOverride -}}
|
|
{{- .Values.mongodb.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
{{- if contains $name .Release.Name -}}
|
|
{{- printf "%s-%s" .Release.Name .Values.mongodb.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- printf "%s-%s-%s" .Release.Name $name .Values.mongodb.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create the mongodb connection string.
|
|
*/}}
|
|
{{- define "infisical.mongodb.connectionString" -}}
|
|
{{- $host := include "infisical.mongodb.fullname" . -}}
|
|
{{- $port := 27017 -}}
|
|
{{- $user := first .Values.mongodb.auth.usernames | default "root" -}}
|
|
{{- $pass := first .Values.mongodb.auth.passwords | default "root" -}}
|
|
{{- $database := first .Values.mongodb.auth.databases | default "test" -}}
|
|
{{- $connectionString := printf "mongodb://%s:%s@%s:%d/%s" $user $pass $host $port $database -}}
|
|
{{/* Backward compatibility (< 0.1.16, deprecated) */}}
|
|
{{- if .Values.mongodbConnection.externalMongoDBConnectionString -}}
|
|
{{- $connectionString = .Values.mongodbConnection.externalMongoDBConnectionString -}}
|
|
{{- end -}}
|
|
{{- printf "%s" $connectionString -}}
|
|
{{- end -}}
|
|
|
|
|
|
{{/*
|
|
Create a fully qualified redis name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
*/}}
|
|
{{- define "infisical.redis.fullname" -}}
|
|
{{- if .Values.redis.fullnameOverride -}}
|
|
{{- .Values.redis.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
{{- if contains $name .Release.Name -}}
|
|
{{- printf "%s-%s" .Release.Name .Values.redis.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- printf "%s-%s-%s" .Release.Name $name .Values.redis.name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create the redis connection string.
|
|
*/}}
|
|
{{- define "infisical.redis.connectionString" -}}
|
|
{{- $host := include "infisical.redis.fullname" . -}}
|
|
{{- $pass := .Values.redis.auth.password | default "root" -}}
|
|
{{- $connectionString := printf "redis://redis:%s@%s:6379" $pass $host -}}
|
|
{{- printf "%s" $connectionString -}}
|
|
{{- end -}} |