dashboard/deployment/helmchart/templates/_helpers.tpl
2021-10-04 13:53:13 +02:00

134 lines
3.9 KiB
Smarty

{{/*
Create the name of the service account to use
*/}}
{{- define "adminPanel.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Return the proper Docker image registry secret names
*/}}
{{- define "adminPanel.imagePullSecrets" -}}
{{ include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) }}
{{- end -}}
{{/*
Return true if a secret object for Admin-frontend should be created
*/}}
{{- define "adminBackend.createSecret" -}}
{{- if or (not .Values.adminBackend.existingSecret) (and (not .Values.adminBackend.smtp.existingSecret) .Values.adminBackend.smtp.password .Values.adminBackend.smtp.enabled) }}
{{- true -}}
{{- end -}}
{{- end -}}
{{/*
Return the Admin-backend secret name
*/}}
{{- define "adminBackend.secretName" -}}
{{- if .Values.adminBackend.existingSecret }}
{{- printf "%s" .Values.adminBackend.existingSecret -}}
{{- else -}}
{{- printf "%s-admin-backend" (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Return the Admin-backend SMTP secret name
*/}}
{{- define "adminBackend.smtp.secretName" -}}
{{- if .Values.adminBackend.smtp.existingSecret }}
{{- printf "%s" .Values.adminBackend.smtp.existingSecret -}}
{{- else -}}
{{- printf "%s-admin-backend" (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Return true if Admin-backend SMTP uses password authentication
*/}}
{{- define "adminBackend.smtp.password.enabled" -}}
{{- if and (or .Values.adminBackend.smtp.password .Values.adminBackend.smtp.existingSecret) .Values.adminBackend.smtp.enabled }}
{{- true -}}
{{- end -}}
{{- end -}}
{{/*
Get the user defined LoadBalancerIP for this release
Note, returns 127.0.0.1 if using ClusterIP.
*/}}
{{- define "adminFrontend.serviceIP" -}}
{{- if eq .Values.adminFrontend.service.type "ClusterIP" -}}
127.0.0.1
{{- else -}}
{{- .Values.adminFrontend.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 "adminFrontend.host" -}}
{{- $host := .Values.adminFrontend.host | default "" -}}
{{- default (include "adminFrontend.serviceIP" .) $host -}}
{{- end -}}
{{/*
Service name for the backend service
*/}}
{{- define "adminBackend.serviceName" -}}
{{ include "common.names.fullname" . }}-backend
{{- end -}}
{{/*
Service name for the frontend service
*/}}
{{- define "adminFrontend.serviceName" -}}
{{ include "common.names.fullname" . }}-frontend
{{- end -}}
{{/*
Get the user defined LoadBalancerIP for this release
Note, returns 127.0.0.1 if using ClusterIP.
*/}}
{{- define "adminBackend.serviceIP" -}}
{{- if eq .Values.adminBackend.service.type "ClusterIP" -}}
127.0.0.1
{{- else -}}
{{- .Values.adminBackend.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 "adminBackend.host" -}}
{{- $host := .Values.adminBackend.host | default "" -}}
{{- default (include "adminBackend.serviceIP" .) $host -}}
{{- end -}}
{{/*
Return the proper Admin-frontend image name
*/}}
{{- define "adminFrontend.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.adminFrontend.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Admin-backend image name
*/}}
{{- define "adminBackend.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.adminBackend.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Storage Class
*/}}
{{- define "adminPanel.storageClass" -}}
{{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) -}}
{{- end -}}