From 6ad3ba062a1f864eef56ba6ec8098366bccb4bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=97=AA=D1=94=CE=BD=CE=B9=CE=B7=20=E1=97=B7=CF=85=D0=BD?= =?UTF-8?q?=CA=9F?= Date: Fri, 4 Dec 2020 18:20:33 -0500 Subject: [PATCH] [esphome] use common (#303) Co-authored-by: Ryan Holt --- charts/esphome/.helmignore | 1 + charts/esphome/Chart.yaml | 15 +- charts/esphome/OWNERS | 4 + charts/esphome/README.md | 140 +++++---------- charts/esphome/ci/ct-values.yaml | 4 + charts/esphome/templates/NOTES.txt | 20 +-- charts/esphome/templates/_helpers.tpl | 32 ---- charts/esphome/templates/common.yaml | 1 + charts/esphome/templates/deployment.yaml | 216 ----------------------- charts/esphome/templates/ingress.yaml | 39 ---- charts/esphome/templates/pvc.yaml | 26 --- charts/esphome/templates/service.yaml | 56 ------ charts/esphome/values.yaml | 195 +++----------------- 13 files changed, 99 insertions(+), 650 deletions(-) create mode 100644 charts/esphome/ci/ct-values.yaml delete mode 100644 charts/esphome/templates/_helpers.tpl create mode 100644 charts/esphome/templates/common.yaml delete mode 100644 charts/esphome/templates/deployment.yaml delete mode 100644 charts/esphome/templates/ingress.yaml delete mode 100644 charts/esphome/templates/pvc.yaml delete mode 100644 charts/esphome/templates/service.yaml diff --git a/charts/esphome/.helmignore b/charts/esphome/.helmignore index 46fd8996..e559de0a 100644 --- a/charts/esphome/.helmignore +++ b/charts/esphome/.helmignore @@ -19,5 +19,6 @@ .project .idea/ *.tmproj +.vscode/ # OWNERS file for Kubernetes OWNERS diff --git a/charts/esphome/Chart.yaml b/charts/esphome/Chart.yaml index aeeeac55..bb48fcfc 100644 --- a/charts/esphome/Chart.yaml +++ b/charts/esphome/Chart.yaml @@ -1,14 +1,19 @@ apiVersion: v2 appVersion: 1.15.3 -description: ESPHome +description: ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems. name: esphome -version: 2.3.0 +version: 3.0.0 keywords: -- esphome + - esphome + - home-automation home: https://github.com/k8s-at-home/charts/tree/master/charts/esphome icon: https://esphome.io/_images/logo-text.svg sources: - https://github.com/esphome/esphome maintainers: -- name: billimek - email: jeff@billimek.com + - name: billimek + email: jeff@billimek.com +dependencies: + - name: common + repository: https://k8s-at-home.com/charts/ + version: 1.7.0 diff --git a/charts/esphome/OWNERS b/charts/esphome/OWNERS index b90909f4..1ce35762 100644 --- a/charts/esphome/OWNERS +++ b/charts/esphome/OWNERS @@ -1,4 +1,8 @@ approvers: - billimek +- onedr0p +- bjw-s reviewers: - billimek +- onedr0p +- bjw-s diff --git a/charts/esphome/README.md b/charts/esphome/README.md index 8abac49b..c97f58e5 100644 --- a/charts/esphome/README.md +++ b/charts/esphome/README.md @@ -1,120 +1,78 @@ -# ESPHome +# esphome -This is a helm chart for [ESPHome](https://esphome.io) +This is a helm chart for [esphome](https://github.com/esphome/esphome). + +**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)** ## TL;DR; ```shell -helm repo add k8s-at-home https://k8s-at-home.com/charts/ -helm install k8s-at-home/esphome +$ helm repo add k8s-at-home https://k8s-at-home.com/charts/ +$ helm install k8s-at-home/esphome ``` -## Introduction - -This code is adapted for [the official esphome docker image](https://hub.docker.com/r/esphome/esphome/) - ## Installing the Chart To install the chart with the release name `my-release`: -```shell +```console helm install --name my-release k8s-at-home/esphome ``` + ## Uninstalling the Chart To uninstall/delete the `my-release` deployment: -```shell +```console helm delete my-release --purge ``` The command removes all the Kubernetes components associated with the chart and deletes the release. ## Configuration - -The following tables lists the configurable parameters of the ESPHome chart and their default values. - -| Parameter | Description | Default | -|----------------------------------------|--------------------------------------------------------------------------------------------------------------------|-----------------------| -| `image.repository` | Image repository | `esphome/esphome` | -| `image.tag` | Image tag. Possible values listed [here](https://hub.docker.com/r/esphome/esphome/tags/). | `0.14.5` | -| `image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `image.pullSecrets` | Secrets to use when pulling the image | `[]` | -| `strategyType` | Specifies the strategy used to replace old Pods by new ones | `Recreate` | -| `probes.liveness.enabled` | Use the livenessProbe? | `true` | -| `probes.liveness.scheme ` | Specify liveness `scheme` parameter for the deployment | `HTTP` | -| `probes.liveness.initialDelaySeconds` | Specify liveness `initialDelaySeconds` parameter for the deployment | `60` | -| `probes.liveness.failureThreshold` | Specify liveness `failureThreshold` parameter for the deployment | `5` | -| `probes.liveness.timeoutSeconds` | Specify liveness `timeoutSeconds` parameter for the deployment | `10` | -| `probes.readiness.enabled` | Use the readinessProbe? | `true` | -| `probes.readiness.scheme ` | Specify readiness `scheme` parameter for the deployment | `HTTP` | -| `probes.readiness.initialDelaySeconds` | Specify readiness `initialDelaySeconds` parameter for the deployment | `60` | -| `probes.readiness.failureThreshold` | Specify readiness `failureThreshold` parameter for the deployment | `5` | -| `probes.readiness.timeoutSeconds` | Specify readiness `timeoutSeconds` parameter for the deployment | `10` | -| `probes.startup.enabled` | Use the startupProbe? (new in kubernetes 1.16) | `false` | -| `probes.startup.scheme ` | Specify startup `scheme` parameter for the deployment | `HTTP` | -| `probes.startup.failureThreshold` | Specify startup `failureThreshold` parameter for the deployment | `5` | -| `probes.startup.periodSeconds` | Specify startup `periodSeconds` parameter for the deployment | `10` | -| `service.type` | Kubernetes service type for the esphome GUI | `ClusterIP` | -| `service.port` | Kubernetes port where the esphome GUI is exposed | `6052` | -| `service.portName` | Kubernetes port name where the esphome GUI is exposed | `api` | -| `service.additionalPorts` | Add additional ports exposed by the esphome container integrations. Example homematic needs to expose a proxy port | `{}` | -| `service.annotations` | Service annotations for the esphome GUI | `{}` | -| `service.clusterIP` | Cluster IP for the esphom GUI | `` | -| `service.externalIPs` | External IPs for the esphome GUI | `[]` | -| `service.loadBalancerIP` | Loadbalancer IP for the esphome GUI | `` | -| `service.loadBalancerSourceRanges` | Loadbalancer client IP restriction range for the esphome GUI | `[]` | -| `service.publishNotReadyAddresses` | Set to true if the notReadyAddresses should be published | `false` | -| `service.externalTrafficPolicy` | Loadbalancer externalTrafficPolicy | `` | -| `hostNetwork` | Enable hostNetwork - might be needed for discovery to work | `false` | -| `service.nodePort` | nodePort to listen on for the esphome GUI | `` | -| `ingress.enabled` | Enables Ingress | `false` | -| `ingress.annotations` | Ingress annotations | `{}` | -| `ingress.path` | Ingress path | `/` | -| `ingress.hosts` | Ingress accepted hostnames | `chart-example.local` | -| `ingress.tls` | Ingress TLS configuration | `[]` | -| `persistence.enabled` | Use persistent volume to store data | `true` | -| `persistence.size` | Size of persistent volume claim | `5Gi` | -| `persistence.existingClaim` | Use an existing PVC to persist data | `nil` | -| `persistence.hostPath` | The path to the config directory on the host, instead of a PVC | `nil` | -| `persistence.storageClass` | Type of persistent volume claim | `-` | -| `persistence.accessMode` | Persistence access modes | `ReadWriteMany` | -| `git.enabled` | Use git-sync in init container | `false` | -| `git.secret` | Git secret to use for git-sync | `git-creds` | -| `git.syncPath` | Git sync path | `/config` | -| `git.keyPath` | Git ssh key path | `/root/.ssh` | -| `git.user.name` | Human-readable name in the “committer” and “author” fields | `` | -| `git.user.email` | Email address for the “committer” and “author” fields | `` | -| `hostMounts` | Array of host directories to mount; can be used for devices | [] | -| `hostMounts.name` | Name of the volume | `nil` | -| `hostMounts.hostPath` | The path on the host machine | `nil` | -| `hostMounts.mountPath` | The path at which to mount (optional; assumed same as hostPath) | `nil` | -| `hostMounts.type` | The type to mount (optional, i.e., `Directory`) | `nil` | -| `extraEnv` | Extra ENV vars to pass to the esphome container | `{}` | -| `extraEnvSecrets` | Extra env vars to pass to the esphome container from k8s secrets - see `values.yaml` for an example | `{}` | -| `resources` | CPU/Memory resource requests/limits or the esphome GUI | `{}` | -| `nodeSelector` | Node labels for pod assignment or the esphome GUI | `{}` | -| `tolerations` | Toleration labels for pod assignment or the esphome GUI | `[]` | -| `affinity` | Affinity settings for pod assignment or the esphome GUI | `{}` | -| `podAnnotations` | Key-value pairs to add as pod annotations | `{}` | -| `extraVolumes` | Any extra volumes to define for the pod | `{}` | -| `extraVolumeMounts` | Any extra volumes mounts to define for each container of the pod | `{}` | - - - +Read through the charts [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/esphome/values.yaml) +file. It has several commented out suggested values. +Additionally you can take a look at the common library [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/common/values.yaml) for more (advanced) configuration options. Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, - -```shell -helm install --name my-release \ - --set image.tag=latest \ +```console +helm install esphome \ + --set env.TZ="America/New_York" \ k8s-at-home/esphome ``` - -Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, - -```shell -helm install --name my-release -f values.yaml k8s-at-home/esphome +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the +chart. For example, +```console +helm install esphome k8s-at-home/esphome --values values.yaml ``` -Read through the [values.yaml](values.yaml) file. It has several commented out suggested values. +```yaml +image: + tag: ... +``` + +--- +**NOTE** + +If you get +```console +Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: ...` +``` +it may be because you uninstalled the chart with `skipuninstall` enabled, you need to manually delete the pvc or use `existingClaim`. + +--- + +## Upgrading an existing Release to a new major version + +A major chart version change (like 4.0.1 -> 5.0.0) indicates that there is an incompatible breaking change potentially needing manual actions. + +### Upgrading from 2.x.x to 3.x.x + +Due to migrating to a centralized common library some values in `values.yaml` have changed. + +Examples: + +* `service.port` has been moved to `service.port.port`. +* `persistence.type` has been moved to `controllerType`. + +Refer to the library values.yaml for more configuration options. diff --git a/charts/esphome/ci/ct-values.yaml b/charts/esphome/ci/ct-values.yaml new file mode 100644 index 00000000..b2a6ec55 --- /dev/null +++ b/charts/esphome/ci/ct-values.yaml @@ -0,0 +1,4 @@ +env: + ESPHOME_DASHBOARD_USE_PING: true +ingress: + enabled: true diff --git a/charts/esphome/templates/NOTES.txt b/charts/esphome/templates/NOTES.txt index 12388a4b..90f7b653 100644 --- a/charts/esphome/templates/NOTES.txt +++ b/charts/esphome/templates/NOTES.txt @@ -1,19 +1 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "esphome.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ template "esphome.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "esphome.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "esphome.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:80 -{{- end }} +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/esphome/templates/_helpers.tpl b/charts/esphome/templates/_helpers.tpl deleted file mode 100644 index e598c9ca..00000000 --- a/charts/esphome/templates/_helpers.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "esphome.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "esphome.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "esphome.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/charts/esphome/templates/common.yaml b/charts/esphome/templates/common.yaml new file mode 100644 index 00000000..a6613c2c --- /dev/null +++ b/charts/esphome/templates/common.yaml @@ -0,0 +1 @@ +{{ include "common.all" . }} diff --git a/charts/esphome/templates/deployment.yaml b/charts/esphome/templates/deployment.yaml deleted file mode 100644 index 1b5ed0bd..00000000 --- a/charts/esphome/templates/deployment.yaml +++ /dev/null @@ -1,216 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "esphome.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "esphome.name" . }} - helm.sh/chart: {{ include "esphome.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - replicas: 1 - strategy: - type: {{ .Values.strategyType }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "esphome.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "esphome.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - {{- if .Values.podAnnotations }} - annotations: - {{- range $key, $value := .Values.podAnnotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} - {{- end }} - spec: - {{- with .Values.image.pullSecrets }} - imagePullSecrets: - {{- range . }} - - name: {{ . }} - {{- end }} - {{- end }} - {{- if .Values.hostNetwork }} - hostNetwork: {{ .Values.hostNetwork }} - dnsPolicy: ClusterFirstWithHostNet - {{- end }} - initContainers: - {{- if .Values.git.enabled }} - - name: git-sync - image: "{{ .Values.git.image.repository }}:{{ .Values.git.image.tag }}" - imagePullPolicy: {{ .Values.git.image.pullPolicy }} - {{- if .Values.git.command }} - command: - {{- range .Values.git.command }} - - {{ . | quote }} - {{- end }} - {{- else }} - command: ["/bin/sh", "-c"] - args: - - set -e; - if [ -d "{{ .Values.git.syncPath }}/.git" ]; - then - git -C "{{ .Values.git.syncPath }}" pull || true; - else - if [ "$(ls -A {{ .Values.git.syncPath }})" ]; - then - git clone --depth 2 "{{ .Values.git.repo }}" /tmp/repo; - cp -rf /tmp/repo/.git "{{ .Values.git.syncPath }}"; - cd "{{ .Values.git.syncPath }}"; - git checkout -f; - else - git clone --depth 2 "{{ .Values.git.repo }}" "{{ .Values.git.syncPath }}"; - fi; - fi; - if [ -f "{{ .Values.git.keyPath }}/git-crypt-key" ]; - then - cd {{ .Values.git.syncPath }}; - git-crypt unlock "{{ .Values.git.keyPath }}/git-crypt-key"; - fi; - {{- end }} - volumeMounts: - - mountPath: /config - name: config - - mountPath: {{ .Values.git.keyPath }} - name: git-secret - {{- if .Values.extraVolumeMounts }}{{ toYaml .Values.extraVolumeMounts | trim | nindent 8 }}{{ end }} - {{- if .Values.usePodSecurityContext }} - securityContext: - runAsUser: {{ default 0 .Values.runAsUser }} - {{- if and (.Values.runAsUser) (.Values.fsGroup) }} - {{- if not (eq .Values.runAsUser 0.0) }} - fsGroup: {{ .Values.fsGroup }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: api - containerPort: {{ .Values.service.port }} - protocol: TCP - {{- range .Values.service.additionalPorts }} - - name: {{ .name }} - containerPort: {{ .targetPort }} - {{- end }} - {{- if .Values.probes.liveness.enabled }} - livenessProbe: - httpGet: - path: /ping - port: api - scheme: {{ .Values.probes.liveness.scheme }} - initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} - failureThreshold: {{ .Values.probes.liveness.failureThreshold }} - timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }} - {{- end }} - {{- if .Values.probes.readiness.enabled }} - readinessProbe: - httpGet: - path: /ping - port: api - scheme: {{ .Values.probes.readiness.scheme }} - initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} - failureThreshold: {{ .Values.probes.readiness.failureThreshold }} - timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} - {{- end }} - {{- if .Values.probes.startup.enabled }} - startupProbe: - httpGet: - path: /ping - port: api - scheme: {{ .Values.probes.startup.scheme }} - failureThreshold: {{ .Values.probes.startup.failureThreshold }} - periodSeconds: {{ .Values.probes.startup.periodSeconds }} - {{- end }} - env: - {{- range $key, $value := .Values.extraEnv }} - - name: {{ $key | quote }} - value: {{ $value | quote }} - {{- end }} - {{- range $name, $opts := .Values.extraEnvSecrets }} - - name: {{ $name }} - valueFrom: - secretKeyRef: - name: {{ $opts.secret }} - key: {{ $opts.key }} - {{- end }} - envFrom: - {{- range .Values.extraSecretForEnvFrom }} - - secretRef: - name: {{ . }} - {{- end }} - volumeMounts: - - mountPath: /config - name: config - {{- range .Values.hostMounts }} - {{- if .mountPath }} - - mountPath: {{ .mountPath }} - {{- else }} - - mountPath: {{ .hostPath }} - {{- end }} - name: {{ .name }} - {{- end }} - {{- if .Values.extraVolumeMounts }}{{ toYaml .Values.extraVolumeMounts | trim | nindent 10 }}{{ end }} - {{- if .Values.usePodSecurityContext }} - securityContext: - runAsUser: {{ default 0 .Values.runAsUser }} - {{- if and (.Values.runAsUser) (.Values.fsGroup) }} - {{- if not (eq .Values.runAsUser 0.0) }} - fsGroup: {{ .Values.fsGroup }} - {{- end }} - {{- end }} - {{- end }} - resources: -{{ toYaml .Values.resources | indent 12 }} - {{- if .Values.hostMounts }} - securityContext: - privileged: true - {{- end }} - volumes: - - name: config - {{- if .Values.persistence.enabled }} - {{- if .Values.persistence.hostPath }} - hostPath: - path: {{.Values.persistence.hostPath}} - type: Directory - {{- else }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "esphome.fullname" . }}{{- end }} - {{- end }} - {{- else }} - emptyDir: {} - {{ end }} - {{- range .Values.hostMounts }} - - name: {{ .name }} - hostPath: - path: {{.hostPath}} - {{- if .type }} - type: {{ .type }} - {{- end }} - {{- end }} - {{- if .Values.git.enabled }} - - name: git-secret - secret: - defaultMode: 256 - secretName: {{ .Values.git.secret }} - optional: true - {{ end }} - {{- if .Values.extraVolumes }}{{ toYaml .Values.extraVolumes | trim | nindent 6 }}{{ end }} - {{- with .Values.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} diff --git a/charts/esphome/templates/ingress.yaml b/charts/esphome/templates/ingress.yaml deleted file mode 100644 index a602d161..00000000 --- a/charts/esphome/templates/ingress.yaml +++ /dev/null @@ -1,39 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "esphome.fullname" . -}} -{{- $servicePort := .Values.service.port -}} -{{- $ingressPath := .Values.ingress.path -}} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - app.kubernetes.io/name: {{ include "esphome.name" . }} - helm.sh/chart: {{ include "esphome.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- with .Values.ingress.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} -{{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ . }} - http: - paths: - - path: {{ $ingressPath }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $servicePort }} - {{- end }} -{{- end }} diff --git a/charts/esphome/templates/pvc.yaml b/charts/esphome/templates/pvc.yaml deleted file mode 100644 index 6d337d40..00000000 --- a/charts/esphome/templates/pvc.yaml +++ /dev/null @@ -1,26 +0,0 @@ -{{- if .Values.persistence.enabled -}} -{{- if not .Values.persistence.existingClaim -}} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "esphome.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "esphome.name" . }} - helm.sh/chart: {{ include "esphome.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - accessModes: - - {{ .Values.persistence.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} -{{- if .Values.persistence.storageClass }} -{{- if (eq "-" .Values.persistence.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" -{{- end }} -{{- end }} -{{- end -}} -{{- end -}} \ No newline at end of file diff --git a/charts/esphome/templates/service.yaml b/charts/esphome/templates/service.yaml deleted file mode 100644 index 5ee74071..00000000 --- a/charts/esphome/templates/service.yaml +++ /dev/null @@ -1,56 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "esphome.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "esphome.name" . }} - helm.sh/chart: {{ include "esphome.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- if .Values.service.labels }} -{{ toYaml .Values.service.labels | indent 4 }} -{{- end }} -{{- with .Values.service.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }} - type: ClusterIP - {{- if .Values.service.clusterIP }} - clusterIP: {{ .Values.service.clusterIP }} - {{end}} -{{- else if eq .Values.service.type "LoadBalancer" }} - type: {{ .Values.service.type }} - {{- if .Values.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} - {{- end }} - {{- if .Values.service.externalTrafficPolicy }} - externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} - {{- end }} - {{- if .Values.service.loadBalancerSourceRanges }} - loadBalancerSourceRanges: -{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} - {{- end -}} -{{- else }} - type: {{ .Values.service.type }} -{{- end }} -{{- if .Values.service.externalIPs }} - externalIPs: -{{ toYaml .Values.service.externalIPs | indent 4 }} -{{- end }} - publishNotReadyAddresses: {{ .Values.service.publishNotReadyAddresses }} - ports: - - name: {{ .Values.service.portName }} - port: {{ .Values.service.port }} - protocol: TCP - targetPort: 6052 -{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} - nodePort: {{.Values.service.nodePort}} -{{ end }} -{{- if .Values.service.additionalPorts }} - {{- .Values.service.additionalPorts | toYaml | indent 4 }} -{{- end }} - selector: - app.kubernetes.io/name: {{ include "esphome.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/esphome/values.yaml b/charts/esphome/values.yaml index 7f98cb85..f97b3bc6 100644 --- a/charts/esphome/values.yaml +++ b/charts/esphome/values.yaml @@ -1,176 +1,39 @@ -# Default values for esphome. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. +# Default values for Bazarr. image: repository: esphome/esphome - tag: 1.15.3 pullPolicy: IfNotPresent - pullSecrets: [] + tag: 1.15.3 -# upgrade strategy type (e.g. Recreate or RollingUpdate) -strategyType: Recreate +strategy: + type: Recreate -# Probes configuration -probes: - liveness: - enabled: true - scheme: HTTP - initialDelaySeconds: 60 - failureThreshold: 5 - timeoutSeconds: 10 - readiness: - enabled: true - scheme: HTTP - initialDelaySeconds: 60 - failureThreshold: 5 - timeoutSeconds: 10 - startup: - enabled: false - scheme: HTTP - failureThreshold: 30 - periodSeconds: 10 service: - type: ClusterIP - port: 6052 - portName: api - additionalPorts: [] - # - name: homematicproxy - # port: 2001 - # targetPort: 2001 - annotations: {} - labels: {} - clusterIP: "" - ## List of IP addresses at which the hass-configurator service is available - ## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips - ## - externalIPs: [] - loadBalancerIP: "" - loadBalancerSourceRanges: [] - # nodePort: 30000 - publishNotReadyAddresses: false + port: + port: 6052 -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - path: / - hosts: - - esphome.local - tls: [] - # - secretName: esphome-tls - # hosts: - # - esphome.local - -hostNetwork: false +env: {} + # ESPHOME_DASHBOARD_USE_PING: true + # ESPHOME_DASHBOARD_RELATIVE_URL: "/" + # ESPHOME_QUICKWIZARD: + # ESPHOME_IS_HASSIO: + # DISABLE_HA_AUTHENTICATION: + # USERNAME: + # PASSWORD: persistence: - enabled: true - ## esphome data Persistent Volume Storage Class - ## If defined, storageClassName: - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) - ## - # storageClass: "-" - ## - ## If you want to reuse an existing claim, you can pass the name of the PVC using - ## the existingClaim variable - # existingClaim: your-claim - ## - ## If you want to use a volume on the host machine instead of a PVC: - # hostPath: /path/to/the/config/folder - accessMode: ReadWriteOnce - size: 1Gi - -## Additional hass container environment variable -## For instance to add a http_proxy -## -extraEnv: {} - -## Additional hass container environment variable from k8s secrets -## For instance to add a password -## can use `!env_var` in the esphome configuration to reference these variables -extraEnvSecrets: - # Example - # This will set ${MQTT_PASSWORD} to the 'password' key from the 'mqtt' secret - # MQTT_PASSWORD: - # secret: mqtt - # key: password - -## If you'd like to provide your own Kubernetes Secret object instead of passing your values -## individually, pass in the name of a created + populated Secret. -## All secrets will be mounted as environment variables, with each key/value mapping to a -## corresponding environment variable. -## -extraSecretForEnvFrom: [] -# - esphome-secrets - -# Enable pod security context (must be `true` if runAsUser or fsGroup are set) -usePodSecurityContext: true -# Set runAsUser to 1000 to let esphome run as non-root user. -# When setting runAsUser to a different value than 0 also set fsGroup to the same value: -# runAsUser: -# fsGroup: - -# Mount devices or folders from the host machine. Can be used for USB device mounting. -hostMounts: [] - # Example - # - name: zha - # hostPath: /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_6120245D-if01-port0 - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -podAnnotations: {} - -# Any extra volumes to define for the pod -extraVolumes: [] - # - name: example-name - # hostPath: - # path: /path/on/host - # type: DirectoryOrCreate - -# Any extra volume mounts to define for the containers -extraVolumeMounts: [] -# - name: example-name -# mountPath: /path/in/container - - -git: - enabled: false - - image: - repository: k8sathome/git-crypt - tag: 2020.09.28 - pullPolicy: IfNotPresent - - ## Specify the command that runs in the git-sync container to pull in configuration. - # command: [] - - # Committer settings - user: - name: "" - email: "" - - repo: "" - secret: git-creds - syncPath: /config - keyPath: /root/.ssh + config: + enabled: false + emptyDir: false + ## Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + # storageClass: "-" + # accessMode: ReadWriteOnce + # size: 1Gi + ## Do not delete the pvc upon helm uninstall + # skipuninstall: false + # existingClaim: ""