cw-infra-apps/livekit/livekit-server/templates/deployment.yaml

148 lines
5.6 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "livekit-server.fullname" . }}
labels:
{{- include "livekit-server.labels" . | nindent 4 }}
{{- if .Values.deploymentAnnotations }}
annotations:
{{- toYaml .Values.deploymentAnnotations | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "livekit-server.selectorLabels" . | nindent 6 }}
{{- if .Values.deploymentStrategy }}
strategy:
{{- toYaml .Values.deploymentStrategy | nindent 4 }}
{{- end }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
labels:
{{- include "livekit-server.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "livekit-server.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.podHostNetwork }}
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
{{- end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: ["--disable-strict-config"]
env:
- name: LIVEKIT_CONFIG
valueFrom:
configMapKeyRef:
name: {{ include "livekit-server.fullname" . }}
key: config.yaml
{{- if and .Values.livekit.turn.enabled .Values.livekit.turn.tls_port (not .Values.livekit.turn.external_tls) }}
- name: LIVEKIT_TURN_CERT
value: /etc/lkcert/tls.crt
- name: LIVEKIT_TURN_KEY
value: /etc/lkcert/tls.key
{{- end }}
ports:
- name: http
containerPort: {{ .Values.livekit.port }}
protocol: TCP
{{- if .Values.livekit.rtc.udp_port }}
- name: rtc-udp
containerPort: {{ .Values.livekit.rtc.udp_port }}
hostPort: {{ .Values.livekit.rtc.udp_port }}
protocol: UDP
{{- end }}
{{- if .Values.livekit.rtc.tcp_port }}
- name: rtc-tcp
containerPort: {{ .Values.livekit.rtc.tcp_port }}
hostPort: {{ .Values.livekit.rtc.tcp_port }}
protocol: TCP
{{- end }}
{{- if .Values.livekit.prometheus_port }}
- name: metrics
containerPort: {{ .Values.livekit.prometheus_port }}
hostPort: {{ .Values.livekit.prometheus_port }}
protocol: TCP
{{- end }}
{{- if .Values.livekit.turn.enabled }}
{{- if .Values.livekit.turn.tls_port }}
- name: turn-tls
containerPort: {{ .Values.livekit.turn.tls_port }}
hostPort: {{ .Values.livekit.turn.tls_port }}
protocol: TCP
{{- end }}
{{- if .Values.livekit.turn.udp_port }}
- name: turn-udp
containerPort: {{ .Values.livekit.turn.udp_port }}
hostPort: {{ .Values.livekit.turn.udp_port }}
protocol: UDP
{{- end }}
{{- end }}
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if or .Values.storeKeysInSecret.enabled (and .Values.livekit.turn.enabled .Values.livekit.turn.tls_port (not .Values.livekit.turn.external_tls)) }}
volumeMounts:
{{- if .Values.storeKeysInSecret.enabled }}
- name: keys-volume
mountPath: {{ .Values.livekit.key_file }}
subPath: {{ .Values.livekit.key_file }}
{{- end }}
{{- if and .Values.livekit.turn.enabled .Values.livekit.turn.tls_port (not .Values.livekit.turn.external_tls) }}
- name: lkturncert
mountPath: /etc/lkcert
readOnly: true
{{- end }}
{{- end }}
{{- if or .Values.storeKeysInSecret.enabled (and .Values.livekit.turn.enabled .Values.livekit.turn.tls_port (not .Values.livekit.turn.external_tls)) }}
volumes:
{{- if .Values.storeKeysInSecret.enabled }}
- name: keys-volume
secret:
secretName: {{ (tpl .Values.storeKeysInSecret.existingSecret .) | default (include "livekit-server.fullname" .) }}
defaultMode: 0600
{{- end }}
{{- if and .Values.livekit.turn.enabled .Values.livekit.turn.tls_port (not .Values.livekit.turn.external_tls) }}
- name: lkturncert
secret:
secretName: {{ required "tls secret required if turn enabled" .Values.livekit.turn.secretName }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}