mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-05 16:22:29 -08:00
167 lines
5.2 KiB
YAML
167 lines
5.2 KiB
YAML
{{- /*
|
|
Copyright 2024 New Vector Ltd
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
*/ -}}
|
|
|
|
|
|
{{- if or $.Values.synapse.enabled $.Values.wellKnownDelegation.enabled -}}
|
|
{{- with .Values.haproxy -}}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
{{- with .annotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "element-io.haproxy.labels" (dict "root" $ "context" .) | nindent 4 }}
|
|
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/haproxy/configmap.yaml") $ | sha1sum }}"
|
|
{{- if $.Values.synapse.enabled }}
|
|
k8s.element.io/synapsehash: "{{ include (print $.Template.BasePath "/synapse/synapse_haproxy_configmap.yaml") $ | sha1sum }}"
|
|
{{- end }}
|
|
{{- if $.Values.wellKnownDelegation.enabled }}
|
|
k8s.element.io/wellknowndelegationhash: "{{ include (print $.Template.BasePath "/well-known/configmap.yaml") $ | sha1sum }}"
|
|
{{- end }}
|
|
name: {{ $.Release.Name }}-haproxy
|
|
namespace: {{ $.Release.Namespace }}
|
|
spec:
|
|
replicas: {{ .replicas }}
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/instance: {{ $.Release.Name }}-haproxy
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxUnavailable: 1
|
|
maxSurge: 2
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "element-io.haproxy.labels" (dict "root" $ "context" .) | nindent 8 }}
|
|
k8s.element.io/confighash: "{{ include (print $.Template.BasePath "/haproxy/configmap.yaml") $ | sha1sum }}"
|
|
{{- if $.Values.synapse.enabled }}
|
|
k8s.element.io/synapsehash: "{{ include (print $.Template.BasePath "/synapse/synapse_haproxy_configmap.yaml") $ | sha1sum }}"
|
|
{{- end }}
|
|
{{- if $.Values.wellKnownDelegation.enabled }}
|
|
k8s.element.io/wellknowndelegationhash: "{{ include (print $.Template.BasePath "/well-known/configmap.yaml") $ | sha1sum }}"
|
|
{{- end }}
|
|
{{- with .annotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- if gt (.replicas | int) 1 }}
|
|
affinity:
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/instance
|
|
operator: In
|
|
values:
|
|
- "{{ $.Release.Name }}-haproxy"
|
|
topologyKey: kubernetes.io/hostname
|
|
{{- end }}
|
|
{{- include "element-io.ess-library.pods.commonSpec" (dict "root" $ "context" (dict "componentValues" . "key" "haproxy" "deployment" true)) | nindent 6 }}
|
|
containers:
|
|
- name: haproxy
|
|
args:
|
|
- "-f"
|
|
- "/usr/local/etc/haproxy/haproxy.cfg"
|
|
- "-dW"
|
|
{{- with .image -}}
|
|
{{- if .digest }}
|
|
image: "{{ .registry }}/{{ .repository }}@{{ .digest }}"
|
|
imagePullPolicy: {{ .pullPolicy | default "IfNotPresent" }}
|
|
{{- else }}
|
|
image: "{{ .registry }}/{{ .repository }}:{{ required "synapse.haproxy.image.tag is required if no digest" .tag }}"
|
|
imagePullPolicy: {{ .pullPolicy | default "Always" }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .containersSecurityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
ports:
|
|
{{- if $.Values.synapse.enabled }}
|
|
- containerPort: 8008
|
|
name: haproxy-synapse
|
|
protocol: TCP
|
|
- containerPort: 8009
|
|
name: haproxy-403
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- if $.Values.wellKnownDelegation.enabled }}
|
|
- containerPort: 8010
|
|
name: haproxy-wkd
|
|
protocol: TCP
|
|
{{- end }}
|
|
- containerPort: 8405
|
|
name: haproxy-metrics
|
|
protocol: TCP
|
|
{{- if $.Values.synapse.enabled }}
|
|
- containerPort: 8406
|
|
name: synapse-ready
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- if $.Values.synapse.enabled }}
|
|
startupProbe:
|
|
httpGet:
|
|
path: /synapse_ready
|
|
port: 8406
|
|
periodSeconds: 2
|
|
failureThreshold: 150
|
|
{{- end }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /haproxy_test
|
|
port: 8405
|
|
initialDelaySeconds: 10
|
|
timeoutSeconds: 5
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /haproxy_test
|
|
port: 8405
|
|
initialDelaySeconds: 20
|
|
timeoutSeconds: 5
|
|
{{- with .resources }}
|
|
resources:
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: haproxy-config
|
|
mountPath: "/usr/local/etc/haproxy"
|
|
readOnly: true
|
|
{{- if $.Values.synapse.enabled }}
|
|
- name: synapse-haproxy
|
|
mountPath: "/synapse"
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- if $.Values.wellKnownDelegation.enabled }}
|
|
- name: well-known-haproxy
|
|
mountPath: "/well-known"
|
|
readOnly: true
|
|
{{- end }}
|
|
volumes:
|
|
- configMap:
|
|
name: "{{ $.Release.Name }}-haproxy"
|
|
defaultMode: 420
|
|
name: haproxy-config
|
|
{{- if $.Values.synapse.enabled }}
|
|
- configMap:
|
|
name: "{{ $.Release.Name }}-synapse-haproxy"
|
|
defaultMode: 420
|
|
name: synapse-haproxy
|
|
{{- end }}
|
|
{{- if $.Values.wellKnownDelegation.enabled }}
|
|
- configMap:
|
|
name: "{{ $.Release.Name }}-well-known-haproxy"
|
|
defaultMode: 420
|
|
name: well-known-haproxy
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|