Files
Gael Goinvic 784f40d834 Adjust defaultMode as they need to be applied to group as well
kubelet mounts files as root owner, so the user bit does not matter at
all
2026-10-14 15:38:13 +00:00

146 lines
5.3 KiB
YAML

{{- /*
Copyright 2024-2025 New Vector Ltd
Copyright 2025-2026 Element Creations Ltd
SPDX-License-Identifier: AGPL-3.0-only
*/ -}}
{{- 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/shared-haproxy-config-hash: "{{ include "element-io.haproxy.configmap-data" (dict "root" $ "context" .) | sha1sum }}"
{{- if $.Values.synapse.enabled }}
k8s.element.io/synapse-haproxy-config-hash: "{{ include "element-io.synapse-haproxy.configmap-data" (dict "root" $) | sha1sum }}"
{{- end }}
{{- if $.Values.wellKnownDelegation.enabled }}
k8s.element.io/wellknowndelegation-haproxy-config-hash: {{ include "element-io.well-known-delegation.configmap-data" (dict "root" $ "context" $.Values.wellKnownDelegation) | sha1sum }}
{{- end }}
name: {{ $.Release.Name }}-haproxy
namespace: {{ $.Release.Namespace }}
spec:
{{ include "element-io.ess-library.workloads.commonSpec" (dict "root" $ "context" (dict "nameSuffix" "haproxy" "kind" "Deployment" "componentValues" .)) | nindent 2 }}
template:
metadata:
labels:
{{- include "element-io.haproxy.labels" (dict "root" $ "context" (dict "image" .image "labels" .labels "withChartVersion" false)) | nindent 8 }}
k8s.element.io/shared-haproxy-config-hash: {{ include "element-io.haproxy.configmap-data" (dict "root" $ "context" .) | sha1sum }}
{{- if $.Values.synapse.enabled }}
k8s.element.io/synapse-haproxy-config-hash: {{ include "element-io.synapse-haproxy.configmap-data" (dict "root" $) | sha1sum }}
{{- end }}
{{- if $.Values.wellKnownDelegation.enabled }}
k8s.element.io/wellknowndelegation-haproxy-config-hash: {{ include "element-io.well-known-delegation.configmap-data" (dict "root" $ "context" $.Values.wellKnownDelegation) | sha1sum }}
{{- end }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "element-io.ess-library.pods.commonSpec" (dict "root" $ "context" (dict "componentValues" . "instanceSuffix" "haproxy" "kind" "Deployment")) | nindent 6 }}
{{- with .extraInitContainers }}
initContainers:
{{- toYaml . | nindent 6 }}
{{- end }}
containers:
- name: haproxy
args:
- "-f"
- "/usr/local/etc/haproxy/haproxy.cfg"
- "-dW"
{{- include "element-io.ess-library.pods.image" (dict "root" $ "context" .image) | nindent 8 }}
{{- with .containersSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- include "element-io.ess-library.pods.env" (dict "root" $ "context" (dict "componentValues" . "componentName" "haproxy")) | nindent 8 }}
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 }}
startupProbe: {{- include "element-io.ess-library.pods.probe" .startupProbe | nindent 10 }}
httpGet:
{{- if $.Values.synapse.enabled }}
path: /synapse_ready
port: synapse-ready
{{- else }}
path: /haproxy_test
port: haproxy-metrics
{{- end }}
livenessProbe: {{- include "element-io.ess-library.pods.probe" .livenessProbe | nindent 10 }}
httpGet:
path: /haproxy_test
port: haproxy-metrics
readinessProbe: {{- include "element-io.ess-library.pods.probe" .readinessProbe | nindent 10 }}
httpGet:
path: /haproxy_test
port: haproxy-metrics
{{- 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 }}
{{- range .extraVolumeMounts }}
- {{ (. | toYaml) | nindent 10 }}
{{- end }}
volumes:
- configMap:
name: "{{ $.Release.Name }}-haproxy"
defaultMode: 288
name: haproxy-config
{{- if $.Values.synapse.enabled }}
- configMap:
name: "{{ $.Release.Name }}-synapse-haproxy"
defaultMode: 288
name: synapse-haproxy
{{- end }}
{{- if $.Values.wellKnownDelegation.enabled }}
- configMap:
name: "{{ $.Release.Name }}-well-known-haproxy"
defaultMode: 288
name: well-known-haproxy
{{- end }}
{{- range .extraVolumes }}
- {{- (tpl (. | toYaml) $) | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}