From 07a3de1ffa5b51c5384174182499cfcd3f779d1b Mon Sep 17 00:00:00 2001 From: sHa Date: Wed, 18 Mar 2026 00:48:12 +0200 Subject: [PATCH] feat: Add ESPHome Helm chart --- esphome/Chart.yaml | 9 ++++++ esphome/templates/deployment.yaml | 52 +++++++++++++++++++++++++++++++ esphome/templates/ingress.yaml | 27 ++++++++++++++++ esphome/templates/service.yaml | 20 ++++++++++++ esphome/values.yaml | 28 +++++++++++++++++ 5 files changed, 136 insertions(+) create mode 100644 esphome/Chart.yaml create mode 100644 esphome/templates/deployment.yaml create mode 100644 esphome/templates/ingress.yaml create mode 100644 esphome/templates/service.yaml create mode 100644 esphome/values.yaml diff --git a/esphome/Chart.yaml b/esphome/Chart.yaml new file mode 100644 index 0000000..b32119e --- /dev/null +++ b/esphome/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: esphome +description: ESPHome Helm chart +type: application +version: 0.1.0 +appVersion: "2026.2.4" +annotations: + version-source: github-release:esphome/esphome + version-pattern: "s|^v||" diff --git a/esphome/templates/deployment.yaml b/esphome/templates/deployment.yaml new file mode 100644 index 0000000..ae93ff0 --- /dev/null +++ b/esphome/templates/deployment.yaml @@ -0,0 +1,52 @@ +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: server + app.kubernetes.io/part-of: home-automation +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }} + spec: + {{- if .Values.hostNetwork }} + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + {{- else }} + dnsPolicy: ClusterFirst + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: 6052 + name: http + - containerPort: 6053 + name: api + env: + - name: TZ + value: {{ .Values.timezone | quote }} + - name: ESPHOME_DASHBOARD_USE_PING + value: {{ .Values.usePing | quote }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: config + mountPath: /config + volumes: + - name: config + hostPath: + path: {{ .Values.volume.hostPath }} + type: DirectoryOrCreate diff --git a/esphome/templates/ingress.yaml b/esphome/templates/ingress.yaml new file mode 100644 index 0000000..8c69441 --- /dev/null +++ b/esphome/templates/ingress.yaml @@ -0,0 +1,27 @@ +{{- range $name, $config := .Values.ingresses }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $.Release.Name }}-{{ $name }} + {{- with $config.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + rules: + - host: {{ $config.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ $.Release.Name }} + port: + number: 80 + {{- with $config.tls }} + tls: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/esphome/templates/service.yaml b/esphome/templates/service.yaml new file mode 100644 index 0000000..2b090c0 --- /dev/null +++ b/esphome/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + type: ClusterIP + selector: + app: {{ .Release.Name }} + ports: + - name: http + port: 80 + targetPort: 6052 + protocol: TCP + - name: api + port: 6053 + targetPort: 6053 + protocol: TCP diff --git a/esphome/values.yaml b/esphome/values.yaml new file mode 100644 index 0000000..2024fbd --- /dev/null +++ b/esphome/values.yaml @@ -0,0 +1,28 @@ +# Default values for ESPHome Helm Chart +image: + repository: ghcr.io/esphome/esphome + pullPolicy: Always + +timezone: "Europe/Kyiv" +usePing: "true" + +resources: + requests: + cpu: "100m" + memory: "256Mi" + limits: + cpu: "2" + memory: "1Gi" + +hostNetwork: true + +volume: + hostPath: "" + +ingresses: {} + # https: + # host: esphome.example.com + # annotations: {} + # tls: + # - hosts: + # - esphome.example.com