helm-charts/home-assistant/templates/zigbee2mqtt/deployment.yaml
2024-03-26 17:42:48 +01:00

99 lines
3.3 KiB
YAML

{{- if .Values.zigbee2mqtt.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "home-assistant.fullname" . }}-zigbee2mqtt
labels:
{{- include "home-assistant.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "home-assistant.selectorLabels" . | nindent 6 }}
type: zigbee2mqtt
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "home-assistant.labels" . | nindent 8 }}
type: zigbee2mqtt
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "home-assistant.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.zigbee2mqtt.securityContext | nindent 12 }}
{{- with .Values.zigbee2mqtt.image }}
image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag }}"
imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "home-assistant.fullname" . }}-zigbee2mqtt
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: device
mountPath: {{ .Values.zigbee2mqtt.config.serial.port }}
{{- if .Values.persistence.enabled }}
- name: data
mountPath: /app/data
{{- end }}
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: device
hostPath:
path: {{ .Values.zigbee2mqtt.device }}
{{- if .Values.persistence.enabled }}
- name: "data"
{{- if and .Values.persistence.hostPath (ne .Values.persistence.storageClass "manual" ) }}
hostPath:
path: {{ .Values.persistence.hostPath }}/zigbee2mqtt
{{- else }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "miniserve.fullname" . }}{{- end }}
{{- end }}
{{- end }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- 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 }}
{{- end }}