Files
charts/bitnami/haproxy/templates/_helpers.tpl
Javier J. Salmerón-García e197fde4ce [bitnami/haproxy] Add chart (#6488)
* [bitnami/haproxy] Add chart

* Requested changes

* Requested changes

* [bitnami/haproxy] Update components versions

Signed-off-by: Bitnami Containers <containers@bitnami.com>

Co-authored-by: Bitnami Containers <containers@bitnami.com>
2021-06-02 09:53:53 +02:00

60 lines
1.7 KiB
Smarty

{{/*
Return the proper haproxy image name
*/}}
{{- define "haproxy.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}
{{/*
Get the configmap name
*/}}
{{- define "haproxy.configMapName" -}}
{{- if .Values.existingConfigmap -}}
{{- printf "%s" .Values.existingConfigmap -}}
{{- else -}}
{{- include "common.names.fullname" . -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "haproxy.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "haproxy.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (printf "%s-foo" (include "common.names.fullname" .)) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Compile all warnings into a single message.
*/}}
{{- define "haproxy.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "haproxy.validateValues.ports" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message -}}
{{- end -}}
{{- end -}}
{{- define "haproxy.validateValues.ports" -}}
{{- if not .Values.containerPorts }}
haproxy: No container ports
HAProxy should at least expose container ports. Please configure the containerPorts values using the following structure.
containerPorts:
- name: <NAME OF THE PORT>
containerPort: <PORT NUMBER>
{{- end }}
{{- end }}