Files
homelab/charts/application/templates/_helpers.tpl
2023-04-10 21:40:14 +02:00

61 lines
1.4 KiB
Smarty

{{/*
Common labels
*/}}
{{- define "common.labels" -}}
app.kubernetes.io/name: {{ .Values.name }}
{{- with .Values.additionalLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "common.annotations" -}}
{{- with .Values.annotations }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{/*
Returns string "true" or empty which will be evaluated to boolean false
*/}}
{{- define "deployment.create" -}}
{{- if not .Values.authOnly }}
{{- true }}
{{- end }}
{{- end }}
{{/*
Returns string "true" or empty which will be evaluated to boolean false
*/}}
{{- define "service.create" -}}
{{- if and .Values.service.create (include "deployment.create" .) }}
{{- true }}
{{- end }}
{{- end }}
{{/*
Returns string "true" or empty which will be evaluated to boolean false
*/}}
{{- define "ingressRoute.create" -}}
{{- if and .Values.ingressRoute.create (or .Values.authOnly (include "service.create" .)) }}
{{- true }}
{{- end }}
{{- end }}
{{/*
Returns string "true" or empty which will be evaluated to boolean false
*/}}
{{- define "auth.create" -}}
{{- if or .Values.authOnly (and .Values.auth.enabled .Values.auth.create (include "ingressRoute.create" .)) }}
{{- true }}
{{- end }}
{{- end }}
{{/*
Return default auth host or custom value if set
*/}}
{{- define "auth.host" -}}
{{ .Values.auth.host | default (print "auth-" .Values.namespace "." .Values.auth.cookieDomain ) }}
{{- end }}