131 lines
4.5 KiB
Smarty
131 lines
4.5 KiB
Smarty
{{- define "hrbox.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.component" -}}
|
|
{{- printf "%s-%s" (include "hrbox.name" .ctx) .name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.selectorLabels" -}}
|
|
service: {{ include "hrbox.component" (dict "ctx" .ctx "name" .name) }}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.labels" -}}
|
|
app: {{ .name }}
|
|
app.kubernetes.io/name: {{ include "hrbox.name" .ctx }}
|
|
app.kubernetes.io/component: {{ .name }}
|
|
app.kubernetes.io/instance: {{ .ctx.Release.Name }}
|
|
app.kubernetes.io/managed-by: {{ .ctx.Release.Service }}
|
|
app.kubernetes.io/version: {{ .ctx.Chart.AppVersion | quote }}
|
|
helm.sh/chart: {{ include "hrbox.chart" .ctx }}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.imagePullSecrets" -}}
|
|
{{- if .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- range .Values.imagePullSecrets }}
|
|
- name: {{ .name | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.imageTag" -}}
|
|
{{- $lastSegment := splitList "/" . | last -}}
|
|
{{- if contains ":" $lastSegment -}}
|
|
{{- splitList ":" $lastSegment | last -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.geonamesUrl" -}}
|
|
{{- .Values.app.geonames.url | default (printf "http://%s:8181" (include "hrbox.component" (dict "ctx" . "name" "geonames"))) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.goworkerUrl" -}}
|
|
{{- .Values.app.goworker.url | default (printf "http://%s:8686" (include "hrbox.component" (dict "ctx" . "name" "goworker"))) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.kedocaUrl" -}}
|
|
{{- .Values.app.kedoca.url | default (printf "http://%s:8558" (include "hrbox.component" (dict "ctx" . "name" "kedoca"))) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.redisHost" -}}
|
|
{{- .Values.app.redis.host | default (include "hrbox.component" (dict "ctx" . "name" "dragonfly")) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.natsUrl" -}}
|
|
{{- .Values.app.nats.url | default (printf "nats://%s:4222" (include "hrbox.component" (dict "ctx" . "name" "nats"))) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.secretName" -}}
|
|
{{- if .Values.secrets.existingSecret -}}
|
|
{{- .Values.secrets.existingSecret -}}
|
|
{{- else -}}
|
|
{{- include "hrbox.component" (dict "ctx" . "name" "secrets") -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- define "hrbox.secretEnv" -}}
|
|
- name: {{ .env }}
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "hrbox.secretName" .ctx | quote }}
|
|
key: {{ .key | quote }}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.host" -}}
|
|
{{- required "Для Nanabush Player нужен непустой ingress.host" .Values.ingress.host -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.publicOrigin" -}}
|
|
{{- printf "https://%s" (include "nanabushPlayer.host" .) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.basePath" -}}
|
|
{{- $path := .Values.app.nanabushPlayer.basePath | default "/nanabush-player" -}}
|
|
{{- $path | trimSuffix "/" -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.issuer" -}}
|
|
{{- if .Values.app.nanabushPlayer.issuer -}}
|
|
{{- .Values.app.nanabushPlayer.issuer -}}
|
|
{{- else -}}
|
|
{{- printf "https://%s/lms/player" (include "nanabushPlayer.host" .) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.serviceName" -}}
|
|
{{- .Values.app.nanabushPlayer.service.name | default (include "hrbox.component" (dict "ctx" . "name" "nanabush-player")) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.backchannelHost" -}}
|
|
{{- .Values.app.nanabushPlayer.deployment.backchannel.host | default (include "hrbox.component" (dict "ctx" . "name" "web")) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.internalOrigin" -}}
|
|
{{- printf "http://%s" (include "nanabushPlayer.backchannelHost" .) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.version" -}}
|
|
{{- $tag := include "hrbox.imageTag" .Values.image.nanabushPlayer -}}
|
|
{{- if not $tag -}}
|
|
{{- fail "image.nanabushPlayer должен содержать явный тег версии, например nanabush-player:1.0.11" -}}
|
|
{{- end -}}
|
|
{{- $tag -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.secretName" -}}
|
|
{{- required "app.nanabushPlayer.deployment.existingSecret.name обязателен, когда Player включён" .Values.app.nanabushPlayer.deployment.existingSecret.name -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.redisUrl" -}}
|
|
{{- printf "redis://%s:%s/%d" (include "hrbox.redisHost" .) (.Values.app.redis.port | toString) (.Values.app.nanabushPlayer.deployment.redis.database | int) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "nanabushPlayer.redisKeyPrefix" -}}
|
|
{{- printf "hrbox:%s:%s" .Release.Namespace .Values.app.nanabushPlayer.deployment.redis.keyPrefixSuffix -}}
|
|
{{- end -}}
|