improwised-charts/charts/frigate/templates/Statefulset.yaml

157 lines
5.2 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "frigate.fullname" . }}
labels:
{{ include "frigate.labels" . | indent 4 }}
spec:
replicas: 1
revisionHistoryLimit: 3
# strategy:
# type: {{ .Values.strategyType }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "frigate.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
serviceName: "frigate"
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "frigate.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{- if and .Values.gpu.nvidia.enabled (.Values.gpu.nvidia.runtimeClassName) }}
runtimeClassName: {{ .Values.gpu.nvidia.runtimeClassName }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ include "frigate.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- if and .Values.coral.enabled (not .Values.securityContext) }}
privileged: true
{{- else }}
{{- toYaml .Values.securityContext | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 5000
protocol: TCP
- name: rtmp
containerPort: 1935
protocol: TCP
{{- if .Values.probes.liveness.enabled }}
livenessProbe:
httpGet:
path: /
port: http
scheme: HTTP
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }}
{{- end }}
{{- if .Values.probes.readiness.enabled }}
readinessProbe:
httpGet:
path: /
port: http
scheme: HTTP
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }}
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }}
{{- end }}
{{- if .Values.probes.startup.enabled }}
startupProbe:
httpGet:
path: /
port: http
scheme: HTTP
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
{{- end }}
env:
{{- if .Values.gpu.nvidia.enabled }}
- name: NVIDIA_DRIVER_CAPABILITIES
value: "all"
- name: NVIDIA_VISIBLE_DEVICES
value: "all"
{{- end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
{{- range .Values.envFromSecrets }}
- secretRef:
name: {{ . }}
{{- end }}
volumeMounts:
{{- if .Values.coral.enabled }}
- mountPath: {{ .Values.coral.hostPath }}
name: coral-dev
{{- end }}
- mountPath: /config
name: config
- mountPath: /data
name: data
- mountPath: /media/frigate
name: data
- name: dshm
mountPath: /dev/shm
{{- if .Values.extraVolumeMounts }}{{ toYaml .Values.extraVolumeMounts | trim | nindent 12 }}{{ end }}
resources:
{{- if .Values.gpu.nvidia.enabled }}
limits:
"nvidia.com/gpu": 1
{{- end }}
{{- if .Values.resources }}
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
volumes:
- name: config
secret:
secretName: {{ template "frigate.fullname" . }}
{{- if .Values.coral.enabled }}
- name: coral-dev
hostPath:
path: {{ .Values.coral.hostPath }}
{{- end }}
- name: dshm
emptyDir:
medium: Memory
sizeLimit: {{ .Values.shmSize }}
{{- if .Values.extraVolumes }}{{ toYaml .Values.extraVolumes | trim | nindent 8 }}{{ end }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
# storageClassName: {{ .Values.storageClassName }}
resources:
requests:
storage: 1Gi
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}