charts/charts-wip/matrix-synapse/templates/well-known.yaml
2020-08-09 11:16:36 +02:00

117 lines
3.5 KiB
YAML

{{- if .Values.wellknown.enabled }}
{{- $wkName := include "matrix-synapse.externalname" (dict "global" . "external" "wellknown-lighttpd") -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $wkName }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
component: well-known
data:
lighttpd.conf: |
server.modules = (
"mod_rewrite",
"mod_status",
"mod_accesslog"
)
include "mime-types.conf"
server.username = "lighttpd"
server.groupname = "lighttpd"
server.document-root = {{ .Values.wellknown.htdocsPath | quote }}
server.pid-file = "/run/lighttpd.pid"
server.errorlog = "/dev/stderr"
url.rewrite-once = (
"^/\.well-known/matrix/server" => "/server.json"
)
status.status-url = "/server-status"
accesslog.filename = "/dev/stderr"
server.json: |-
{{ dict "m.server" (printf "%s:%d" (default .Values.wellknown.host .Values.config.serverName) (default .Values.wellknown.port 443)) | toJson | indent 4 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ $wkName }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
component: well-known
spec:
type: ClusterIP
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
{{- include "matrix-synapse.selectorLabels" . | nindent 4 }}
component: well-known
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $wkName }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
component: well-known
spec:
replicas: {{ .Values.wellknown.replicaCount | default 1 }}
selector:
matchLabels:
{{- include "matrix-synapse.selectorLabels" . | nindent 6 }}
component: well-known
template:
metadata:
annotations:
checksum/server-addr: {{ sha256sum (printf "%s:%d" (default .Values.wellknown.host .Values.config.serverName) (default .Values.wellknown.port 443)) }}
labels:
{{- include "matrix-synapse.selectorLabels" . | nindent 8 }}
component: well-known
spec:
{{- include "matrix-synapse.imagePullSecrets" . | nindent 6 }}
securityContext:
{{- toYaml .Values.wellknown.podSecurityContext | nindent 8 }}
containers:
- name: lighttpd
image: "{{ .Values.wellknown.image.repository }}:{{ .Values.wellknown.image.tag }}"
imagePullPolicy: {{ .Values.wellknown.image.pullPolicy }}
securityContext:
{{- toYaml .Values.wellknown.securityContext | nindent 12 }}
ports:
- containerPort: 80
name: http
protocol: TCP
readinessProbe:
tcpSocket:
port: http
livenessProbe:
httpGet:
path: /server-status
port: http
volumeMounts:
- mountPath: /etc/lighttpd/lighttpd.conf
name: files
subPath: lighttpd.conf
- mountPath: {{ .Values.wellknown.htdocsPath }}/server.json
name: files
subPath: server.json
resources:
{{- toYaml .Values.wellknown.resources | nindent 12 }}
volumes:
- name: files
configMap:
name: {{ $wkName }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}