From ae45a4f962bd597325e5aaa8a6bf2d2da0403df0 Mon Sep 17 00:00:00 2001 From: coldfire84 Date: Sat, 14 Nov 2020 20:10:20 +0000 Subject: [PATCH] Add support for hostAliases (#154) Co-authored-by: Jeff Billimek --- charts/home-assistant/Chart.yaml | 2 +- charts/home-assistant/README.md | 3 ++- charts/home-assistant/templates/deployment.yaml | 6 +++++- charts/home-assistant/values.yaml | 8 ++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/charts/home-assistant/Chart.yaml b/charts/home-assistant/Chart.yaml index 4dc021ce..b91a97fc 100644 --- a/charts/home-assistant/Chart.yaml +++ b/charts/home-assistant/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 0.116.1 description: Home Assistant name: home-assistant -version: 2.6.0 +version: 2.7.0 keywords: - home-assistant - hass diff --git a/charts/home-assistant/README.md b/charts/home-assistant/README.md index 7d2581b2..e109daca 100644 --- a/charts/home-assistant/README.md +++ b/charts/home-assistant/README.md @@ -68,6 +68,7 @@ The following tables lists the configurable parameters of the Home Assistant cha | `service.publishNotReadyAddresses` | Set to true if the editors (vscode or configurator) should be reachable when home assistant does not run | `false` | | `service.externalTrafficPolicy` | Loadbalancer externalTrafficPolicy | `` | | `hostNetwork` | Enable hostNetwork - might be needed for discovery to work | `false` | +| `hostAliases` | Define custom entries in /etc/hosts | `[]` | | `service.nodePort` | nodePort to listen on for the home-assistant GUI | `` | | `ingress.enabled` | Enables Ingress | `false` | | `ingress.annotations` | Ingress annotations | `{}` | @@ -234,7 +235,7 @@ kubectl create secret generic git-creds --from-file=id_rsa=git/k8s_id_rsa --from ## git-crypt support -When using Git sync it is possible to specify a file called `git-crypt-key` in the secret referred to in `git.secret`. When this file is present, `git-crypt unlock` will automatically be executed after the repo has been synced. +When using Git sync it is possible to specify a file called `git-crypt-key` in the secret referred to in `git.secret`. When this file is present, `git-crypt unlock` will automatically be executed after the repo has been synced. **Note:** `git-crypt` is not installed by default in the other images! If you wish to push changes from the VS Code or Configurator containers, you will have to make sure that it is installed. diff --git a/charts/home-assistant/templates/deployment.yaml b/charts/home-assistant/templates/deployment.yaml index fc0f2ab8..0dea79a6 100644 --- a/charts/home-assistant/templates/deployment.yaml +++ b/charts/home-assistant/templates/deployment.yaml @@ -37,6 +37,10 @@ spec: {{- if .Values.hostNetwork }} hostNetwork: {{ .Values.hostNetwork }} dnsPolicy: ClusterFirstWithHostNet + {{- end }} + {{- if .Values.hostAliases }} + hostAliases: +{{ toYaml .Values.hostAliases | indent 8 }} {{- end }} initContainers: {{- if .Values.git.enabled }} @@ -56,7 +60,7 @@ spec: then git -C "{{ .Values.git.syncPath }}" pull || true; else - if [ "$(ls -A {{ .Values.git.syncPath }})" ]; + if [ "$(ls -A {{ .Values.git.syncPath }})" ]; then git clone --depth 2 "{{ .Values.git.repo }}" /tmp/repo; cp -rf /tmp/repo/.git "{{ .Values.git.syncPath }}"; diff --git a/charts/home-assistant/values.yaml b/charts/home-assistant/values.yaml index 521e68f8..a17bb935 100644 --- a/charts/home-assistant/values.yaml +++ b/charts/home-assistant/values.yaml @@ -65,6 +65,14 @@ ingress: hostNetwork: false +hostAliases: [] + # Use hostAliases to add custom entries to /etc/hosts - mapping IP addresses to hostnames. + # ref: https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ + # - ip: "192.168.1.100" + # hostnames: + # - "example.com" + # - "www.example.com" + persistence: enabled: true ## home-assistant data Persistent Volume Storage Class