2019-12-12 12:38:31 -06:00
|
|
|
{{/* vim: set filetype=mustache: */}}
|
|
|
|
{{/*
|
|
|
|
Expand the name of the chart.
|
|
|
|
*/}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- define "gitea.name" -}}
|
2019-12-12 12:38:31 -06:00
|
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create a default fully qualified app name.
|
2020-08-23 12:56:55 -05:00
|
|
|
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.
|
2019-12-12 12:38:31 -06:00
|
|
|
*/}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- define "gitea.fullname" -}}
|
|
|
|
{{- if .Values.fullnameOverride -}}
|
|
|
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- else -}}
|
2019-12-12 12:38:31 -06:00
|
|
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- 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 "gitea.chart" -}}
|
|
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Common labels
|
|
|
|
*/}}
|
|
|
|
{{- define "gitea.labels" -}}
|
|
|
|
helm.sh/chart: {{ include "gitea.chart" . }}
|
2021-03-01 06:20:55 -06:00
|
|
|
app: {{ include "gitea.name" . }}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{ include "gitea.selectorLabels" . }}
|
|
|
|
{{- if .Chart.AppVersion }}
|
|
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
2021-03-01 06:20:55 -06:00
|
|
|
version: {{ .Chart.AppVersion | quote }}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- end }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Selector labels
|
|
|
|
*/}}
|
|
|
|
{{- define "gitea.selectorLabels" -}}
|
|
|
|
app.kubernetes.io/name: {{ include "gitea.name" . }}
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "db.servicename" -}}
|
|
|
|
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
|
|
|
{{- printf "%s-postgresql" .Release.Name -}}
|
|
|
|
{{- else if .Values.gitea.database.builtIn.mysql.enabled -}}
|
|
|
|
{{- printf "%s-mysql" .Release.Name -}}
|
2020-09-28 18:26:06 -05:00
|
|
|
{{- else if .Values.gitea.database.builtIn.mariadb.enabled -}}
|
|
|
|
{{- printf "%s-mariadb" .Release.Name -}}
|
2021-03-04 02:43:52 -06:00
|
|
|
{{- else if ne .Values.gitea.config.database.DB_TYPE "sqlite3" -}}
|
2020-09-03 16:27:11 -05:00
|
|
|
{{- $parts := split ":" .Values.gitea.config.database.HOST -}}
|
|
|
|
{{- printf "%s %s" $parts._0 $parts._1 -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "db.port" -}}
|
|
|
|
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
|
|
|
{{ .Values.postgresql.global.postgresql.servicePort }}
|
|
|
|
{{- else if .Values.gitea.database.builtIn.mysql.enabled -}}
|
|
|
|
{{ .Values.mysql.service.port }}
|
2020-09-28 18:26:06 -05:00
|
|
|
{{- else if .Values.gitea.database.builtIn.mariadb.enabled -}}
|
2020-10-22 00:13:37 -05:00
|
|
|
{{ .Values.mariadb.primary.service.port }}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- else -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-09-28 18:26:06 -05:00
|
|
|
{{- define "postgresql.dns" -}}
|
2020-10-29 12:08:58 -05:00
|
|
|
{{- printf "%s-postgresql.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.postgresql.global.postgresql.servicePort -}}
|
2020-09-28 18:26:06 -05:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- define "mysql.dns" -}}
|
2020-10-29 12:08:58 -05:00
|
|
|
{{- printf "%s-mysql.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.mysql.service.port | trunc 63 | trimSuffix "-" -}}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-09-28 18:26:06 -05:00
|
|
|
{{- define "mariadb.dns" -}}
|
2020-10-29 12:08:58 -05:00
|
|
|
{{- printf "%s-mariadb.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.mariadb.primary.service.port | trunc 63 | trimSuffix "-" -}}
|
2020-09-28 18:26:06 -05:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- define "memcached.dns" -}}
|
2020-10-29 12:08:58 -05:00
|
|
|
{{- printf "%s-memcached.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.memcached.service.port | trunc 63 | trimSuffix "-" -}}
|
2019-12-12 12:38:31 -06:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- define "gitea.default_domain" -}}
|
2020-10-29 12:08:58 -05:00
|
|
|
{{- printf "%s-gitea.%s.svc.%s" (include "gitea.fullname" .) .Release.Namespace .Values.clusterDomain | trunc 63 | trimSuffix "-" -}}
|
2019-12-12 12:38:31 -06:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-12-16 06:37:47 -06:00
|
|
|
{{- define "gitea.ldap_settings" -}}
|
|
|
|
{{- range $key, $val := .Values.gitea.ldap -}}
|
|
|
|
{{- if ne $key "enabled" -}}
|
|
|
|
{{- if eq $key "port" -}}
|
2021-01-14 01:13:49 -06:00
|
|
|
{{- printf "--%s %d " ($key | kebabcase) ($val | int) -}}
|
2020-12-16 06:37:47 -06:00
|
|
|
{{- else -}}
|
|
|
|
{{- printf "--%s %s " ($key | kebabcase) ($val | quote) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2021-03-01 06:24:11 -06:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "gitea.oauth_settings" -}}
|
|
|
|
{{- range $key, $val := .Values.gitea.oauth -}}
|
|
|
|
{{- if ne $key "enabled" -}}
|
|
|
|
{{- printf "--%s %s " ($key | kebabcase) ($val | quote) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2020-12-16 06:37:47 -06:00
|
|
|
{{- end -}}
|