1
0
Fork 0
docker-easy-haproxy/helm/easyhaproxy/templates/deployment.yaml
2025-04-16 12:10:25 -05:00

80 lines
3.2 KiB
YAML

---
apiVersion: apps/v1
kind: {{ ternary "Deployment" "DaemonSet" .Values.service.create }}
metadata:
name: {{ include "easyhaproxy.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "easyhaproxy.labels" . | nindent 4 }}
spec:
{{- if .Values.service.create }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
{{- include "easyhaproxy.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "easyhaproxy.selectorLabels" . | nindent 8 }}
spec:
{{- if not .Values.service.create }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: {{ .Values.masterNode.label }}
operator: In
values:
{{- toYaml .Values.masterNode.values | nindent 18 }}
{{- end }}
serviceAccountName: {{ include "easyhaproxy.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
{{ if not .Values.service.create }}hostPort: {{ .Values.binding.ports.http }}{{ end }}
- name: https
containerPort: 443
{{ if not .Values.service.create }}hostPort: {{ .Values.binding.ports.https }}{{ end }}
- name: stats
containerPort: 1936
{{ if not .Values.service.create }}hostPort: {{ .Values.binding.ports.stats }}{{ end }}
{{- range $port := .Values.binding.additionalPorts }}
- name: extra{{ $port }}
containerPort: {{ $port }}
{{ if not $.Values.service.create }}hostPort: {{ $port }}{{ end }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: EASYHAPROXY_DISCOVER
value: kubernetes
- name: HAPROXY_USERNAME
value: {{ .Values.easyhaproxy.stats.username }}
- name: HAPROXY_PASSWORD
value: {{ .Values.easyhaproxy.stats.password }}
- name: EASYHAPROXY_REFRESH_CONF
value: {{ .Values.easyhaproxy.refresh | quote }}
- name: HAPROXY_CUSTOMERRORS
value: {{ .Values.easyhaproxy.customErrors | quote}}
- name: EASYHAPROXY_SSL_MODE
value: {{ .Values.easyhaproxy.sslMode }}
- name: EASYHAPROXY_LOG_LEVEL
value: {{ .Values.easyhaproxy.logLevel.easyhaproxy }}
- name: HAPROXY_LOG_LEVEL
value: {{ .Values.easyhaproxy.logLevel.haproxy }}
- name: CERTBOT_LOG_LEVEL
value: {{ .Values.easyhaproxy.logLevel.certbot }}
{{- if .Values.easyhaproxy.certbot.email }}
- name: EASYHAPROXY_CERTBOT_EMAIL
value: {{ .Values.easyhaproxy.certbot.email }}
{{ end }}