charts/home-assistant/templates/configurator-deployment.yaml

102 lines
3.7 KiB
YAML
Raw Normal View History

2018-07-03 03:50:38 +00:00
{{- if .Values.configurator.enabled -}}
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "home-assistant.configurator.fullname" . }}
labels:
app: {{ template "home-assistant.name" . }}
chart: {{ template "home-assistant.chart" . }}
component: "{{ .Release.Name }}-{{ .Values.configurator.name }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.configurator.replicaCount }}
selector:
matchLabels:
app: {{ template "home-assistant.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "home-assistant.name" . }}
component: "{{ .Values.configurator.name }}"
release: {{ .Release.Name }}
component: "{{ .Release.Name }}-{{ .Values.configurator.name }}"
spec:
containers:
- name: {{ template "home-assistant.name" . }}-{{ .Values.configurator.name }}
image: "{{ .Values.configurator.image.repository }}:{{ .Values.configurator.image.tag }}"
imagePullPolicy: {{ .Values.configurator.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.configurator.service.port }}
protocol: TCP
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 30
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 15
env:
{{- if .Values.configurator.hassApiPassword }}
- name: HC_HASS_API_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "home-assistant.configurator.fullname" . }}
key: hass-api-password
{{- end }}
{{- if .Values.configurator.credentials }}
- name: HC_CREDENTIALS
valueFrom:
secretKeyRef:
name: {{ template "home-assistant.configurator.fullname" . }}
key: credentials
{{- end }}
{{- if .Values.configurator.hassApiUrl }}
- name: HC_HASS_API
value: "{{ .Values.configurator.hassApiUrl }}"
{{- else }}
- name: HC_HASS_API
value: "http://{{ template "home-assistant.fullname" . }}:{{ .Values.service.port }}/api/"
{{- end }}
{{- if .Values.configurator.basepath }}
- name: HC_BASEPATH
value: "{{ .Values.configurator.basepath }}"
{{- end }}
{{- if .Values.configurator.enforceBasepath }}
- name: HC_ENFORCE_BASEPATH
value: "{{ .Values.configurator.enforceBasepath }}"
{{- end }}
{{- range $key, $value := .Values.configurator.extraEnv }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
volumeMounts:
- mountPath: /config
name: config
resources:
{{ toYaml .Values.configurator.resources | indent 12 }}
volumes:
- name: config
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "home-assistant.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{ end }}
{{- with .Values.configurator.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.configurator.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.configurator.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}