mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-08-28 19:43:12 +00:00
98 lines
3.2 KiB
YAML
98 lines
3.2 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ .Release.Name }}
|
|
labels:
|
|
app.kubernetes.io/name: {{ .Chart.Name }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
app.kubernetes.io/component: mqtt-bridge
|
|
app.kubernetes.io/part-of: home-automation
|
|
annotations:
|
|
version-source: {{ index .Chart.Annotations "version-source" }}
|
|
version-pattern: {{ index .Chart.Annotations "version-pattern" | quote }}
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate # Only one instance should control the AC units
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Release.Name }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ .Release.Name }}
|
|
annotations:
|
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
spec:
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
env:
|
|
- name: TZ
|
|
value: {{ .Values.timezone | quote }}
|
|
{{- if .Values.existingSecret }}
|
|
- name: MQTT_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.existingSecret }}
|
|
key: {{ .Values.secretKeys.mqttUser }}
|
|
- name: MQTT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.existingSecret }}
|
|
key: {{ .Values.secretKeys.mqttPassword }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /app/config
|
|
readOnly: true
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
# Startup probe: give MQTT connection and device auth time to complete
|
|
startupProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- 'pgrep -f /main > /dev/null'
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
failureThreshold: 12 # 60 seconds total startup time
|
|
# Liveness probe: verify process is still running
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- 'pgrep -f /main > /dev/null'
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 30
|
|
failureThreshold: 3
|
|
# Readiness probe: check config file is present and process is running
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- 'test -f /app/config/config.yml && pgrep -f /main > /dev/null'
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 15
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: {{ .Release.Name }}-config
|