- infra (k8s, kind, helm, docker) backbone is implemented - security: implementation + unit tests are done
219 lines
5.6 KiB
Smarty
219 lines
5.6 KiB
Smarty
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "incidentops.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create a default fully qualified app name.
|
|
*/}}
|
|
{{- define "incidentops.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 "incidentops.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Common labels
|
|
*/}}
|
|
{{- define "incidentops.labels" -}}
|
|
helm.sh/chart: {{ include "incidentops.chart" . }}
|
|
{{ include "incidentops.selectorLabels" . }}
|
|
{{- if .Chart.AppVersion }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
{{- end }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Selector labels
|
|
*/}}
|
|
{{- define "incidentops.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "incidentops.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
API labels
|
|
*/}}
|
|
{{- define "incidentops.api.labels" -}}
|
|
{{ include "incidentops.labels" . }}
|
|
app.kubernetes.io/component: api
|
|
{{- end }}
|
|
|
|
{{- define "incidentops.api.selectorLabels" -}}
|
|
{{ include "incidentops.selectorLabels" . }}
|
|
app.kubernetes.io/component: api
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Worker labels
|
|
*/}}
|
|
{{- define "incidentops.worker.labels" -}}
|
|
{{ include "incidentops.labels" . }}
|
|
app.kubernetes.io/component: worker
|
|
{{- end }}
|
|
|
|
{{- define "incidentops.worker.selectorLabels" -}}
|
|
{{ include "incidentops.selectorLabels" . }}
|
|
app.kubernetes.io/component: worker
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Web labels
|
|
*/}}
|
|
{{- define "incidentops.web.labels" -}}
|
|
{{ include "incidentops.labels" . }}
|
|
app.kubernetes.io/component: web
|
|
{{- end }}
|
|
|
|
{{- define "incidentops.web.selectorLabels" -}}
|
|
{{ include "incidentops.selectorLabels" . }}
|
|
app.kubernetes.io/component: web
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the name of the service account to use
|
|
*/}}
|
|
{{- define "incidentops.serviceAccountName" -}}
|
|
{{- if .Values.serviceAccount.create }}
|
|
{{- default (include "incidentops.fullname" .) .Values.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
PostgreSQL host
|
|
*/}}
|
|
{{- define "incidentops.postgresql.host" -}}
|
|
{{- if .Values.postgresql.enabled }}
|
|
{{- printf "%s-postgresql" (include "incidentops.fullname" .) }}
|
|
{{- else }}
|
|
{{- .Values.externalDatabase.host }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
PostgreSQL port
|
|
*/}}
|
|
{{- define "incidentops.postgresql.port" -}}
|
|
{{- if .Values.postgresql.enabled }}
|
|
{{- printf "5432" }}
|
|
{{- else }}
|
|
{{- .Values.externalDatabase.port | default "5432" }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Database URL
|
|
*/}}
|
|
{{- define "incidentops.databaseUrl" -}}
|
|
{{- $host := include "incidentops.postgresql.host" . }}
|
|
{{- $port := include "incidentops.postgresql.port" . }}
|
|
{{- if .Values.postgresql.enabled }}
|
|
{{- printf "postgresql://%s:%s@%s:%s/%s" .Values.postgresql.auth.username .Values.postgresql.auth.password $host $port .Values.postgresql.auth.database }}
|
|
{{- else }}
|
|
{{- printf "postgresql://%s:%s@%s:%s/%s" .Values.externalDatabase.user .Values.externalDatabase.password $host $port .Values.externalDatabase.database }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Redis host
|
|
*/}}
|
|
{{- define "incidentops.redis.host" -}}
|
|
{{- if .Values.redis.enabled }}
|
|
{{- printf "%s-redis" (include "incidentops.fullname" .) }}
|
|
{{- else }}
|
|
{{- .Values.externalRedis.host }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Redis URL
|
|
*/}}
|
|
{{- define "incidentops.redisUrl" -}}
|
|
{{- $host := include "incidentops.redis.host" . }}
|
|
{{- if .Values.redis.enabled }}
|
|
{{- printf "redis://%s:6379/0" $host }}
|
|
{{- else }}
|
|
{{- printf "redis://%s:%s/%s" $host (.Values.externalRedis.port | default "6379") (.Values.externalRedis.database | default "0") }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Celery broker URL
|
|
*/}}
|
|
{{- define "incidentops.celeryBrokerUrl" -}}
|
|
{{ include "incidentops.redisUrl" . }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Celery result backend URL
|
|
*/}}
|
|
{{- define "incidentops.celeryResultBackend" -}}
|
|
{{- $host := include "incidentops.redis.host" . }}
|
|
{{- if .Values.redis.enabled }}
|
|
{{- printf "redis://%s:6379/1" $host }}
|
|
{{- else }}
|
|
{{- printf "redis://%s:%s/%s" $host (.Values.externalRedis.port | default "6379") (add (.Values.externalRedis.database | default 0) 1) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
API image
|
|
*/}}
|
|
{{- define "incidentops.api.image" -}}
|
|
{{- $registry := .Values.global.imageRegistry | default "" }}
|
|
{{- $repository := .Values.api.image.repository }}
|
|
{{- $tag := .Values.api.image.tag | default .Chart.AppVersion }}
|
|
{{- if $registry }}
|
|
{{- printf "%s/%s:%s" $registry $repository $tag }}
|
|
{{- else }}
|
|
{{- printf "%s:%s" $repository $tag }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Worker image
|
|
*/}}
|
|
{{- define "incidentops.worker.image" -}}
|
|
{{- $registry := .Values.global.imageRegistry | default "" }}
|
|
{{- $repository := .Values.worker.image.repository }}
|
|
{{- $tag := .Values.worker.image.tag | default .Chart.AppVersion }}
|
|
{{- if $registry }}
|
|
{{- printf "%s/%s:%s" $registry $repository $tag }}
|
|
{{- else }}
|
|
{{- printf "%s:%s" $repository $tag }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Web image
|
|
*/}}
|
|
{{- define "incidentops.web.image" -}}
|
|
{{- $registry := .Values.global.imageRegistry | default "" }}
|
|
{{- $repository := .Values.web.image.repository }}
|
|
{{- $tag := .Values.web.image.tag | default .Chart.AppVersion }}
|
|
{{- if $registry }}
|
|
{{- printf "%s/%s:%s" $registry $repository $tag }}
|
|
{{- else }}
|
|
{{- printf "%s:%s" $repository $tag }}
|
|
{{- end }}
|
|
{{- end }}
|