helm-charts/home-assistant/templates/nats/deployment.yaml

103 lines
3.4 KiB
YAML
Raw Permalink Normal View History

2024-03-26 10:56:05 +01:00
{{- if .Values.nats.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "home-assistant.fullname" . }}-nats
labels:
{{- include "home-assistant.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "home-assistant.selectorLabels" . | nindent 6 }}
type: nats
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "home-assistant.labels" . | nindent 8 }}
type: nats
{{- 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.securityContext | nindent 12 }}
{{- with .Values.nats.image }}
image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag }}"
imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }}
{{- end }}
ports:
- name: nats
containerPort: 4222
protocol: TCP
- name: mqtt
containerPort: 1883
protocol: TCP
livenessProbe:
{{- toYaml .Values.nats.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.nats.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.nats.resources | nindent 12 }}
volumeMounts:
- name: config
mountPath: /nats-server.conf
subPath: nats-server.conf
readOnly: true
{{- if .Values.persistence.enabled }}
- name: data
mountPath: /var/lib/nats
{{- end }}
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: "config"
configMap:
name: {{ include "home-assistant.fullname" . }}-nats
items:
- key: "server.conf"
path: "nats-server.conf"
{{- if .Values.persistence.enabled }}
- name: "data"
{{- if and .Values.persistence.hostPath (ne .Values.persistence.storageClass "manual" ) }}
hostPath:
path: {{ .Values.persistence.hostPath }}/nats/
{{- 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 }}