billimek / billimek-charts

DEPRECATED - new home is https://github.com/k8s-at-home/charts
Apache License 2.0
89 stars 52 forks source link

[home-assistant] Homeassistant fails to clone configuration files #251

Closed rwlove closed 4 years ago

rwlove commented 4 years ago

When the Home Assistant helm chart runs the following command it never pulls in my git configuration. The problem is that the default {{.Values.git.syncPath}} is already populated, so the clone never occurs.

Where are the default configuration files coming from? I would expect this directory to be empty on the first run. Note the configuration.yaml, secrets.yaml and other Home Assistant configuration files in the directory listing below.

git:
  enabled: true

  ## we just use the hass-configurator container image                                                                                        
  ## you can use any image which has git and openssh installed                                                                                
  ##                                                                                                                                          
  image:
    repository: causticlab/hass-configurator-docker
    tag: 0.3.5-x86_64
    pullPolicy: IfNotPresent

  ## Specify the command that runs in the git-sync container to pull in configuration.                                                        
  # command: []                                                                                                                               

  # Committer settings                                                                                                                        
  user:
    name: "my-user-name"
    email: "my-email-address@gmail.com"

  repo: git@github.com:rwlove/homeassistant-configuration.git
  secret: git-creds
  syncPath: /config
  keyPath: /root/.ssh

I do have a valid git-creds secret.

command: ['sh', '-c', '[ "$(ls {{ .Values.git.syncPath }})" ] || git clone {{ .Values.git.repo }} {{ .Values.git.syncPath }}']
[root@brain ~]# find /mnt/mass_storage/kubernetes/homeassistant/
/mnt/mass_storage/kubernetes/homeassistant/
/mnt/mass_storage/kubernetes/homeassistant/deps
/mnt/mass_storage/kubernetes/homeassistant/configuration.yaml
/mnt/mass_storage/kubernetes/homeassistant/secrets.yaml
/mnt/mass_storage/kubernetes/homeassistant/.HA_VERSION
/mnt/mass_storage/kubernetes/homeassistant/groups.yaml
/mnt/mass_storage/kubernetes/homeassistant/automations.yaml
/mnt/mass_storage/kubernetes/homeassistant/scripts.yaml
/mnt/mass_storage/kubernetes/homeassistant/scenes.yaml
/mnt/mass_storage/kubernetes/homeassistant/home-assistant_v2.db
/mnt/mass_storage/kubernetes/homeassistant/.cloud
/mnt/mass_storage/kubernetes/homeassistant/home-assistant.log
/mnt/mass_storage/kubernetes/homeassistant/tts
/mnt/mass_storage/kubernetes/homeassistant/.storage
/mnt/mass_storage/kubernetes/homeassistant/.storage/http
/mnt/mass_storage/kubernetes/homeassistant/.storage/core.entity_registry
/mnt/mass_storage/kubernetes/homeassistant/.storage/auth_provider.homeassistant
/mnt/mass_storage/kubernetes/homeassistant/.storage/core.restore_state
/mnt/mass_storage/kubernetes/homeassistant/.storage/onboarding
/mnt/mass_storage/kubernetes/homeassistant/.storage/auth
/mnt/mass_storage/kubernetes/homeassistant/.storage/person
/mnt/mass_storage/kubernetes/homeassistant/.storage/core.area_registry
/mnt/mass_storage/kubernetes/homeassistant/.storage/core.config
/mnt/mass_storage/kubernetes/homeassistant/.storage/core.config_entries
/mnt/mass_storage/kubernetes/homeassistant/.storage/frontend.user_data_899b933df47749c1a1899343a3e3e2b4
/mnt/mass_storage/kubernetes/homeassistant/appdaemon
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/appdaemon.yaml
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/apps
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/apps/apps.yaml.example
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/apps/hello.py
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/apps/apps.yaml
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/apps/__pycache__
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/apps/__pycache__/hello.cpython-36.pyc
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/dashboards
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/dashboards/Hello.dash
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/compiled
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/compiled/javascript
/mnt/mass_storage/kubernetes/homeassistant/appdaemon/compiled/css
rwlove commented 4 years ago

This is no longer an issue for me. The git-creds that I was using was incorrect. Unfortunately, there isn't any real documentation on how to configure git-creds for this chart.

This is what worked for me after adding generating a RSA key and adding my public key to github via the webui.

ssh-keyscan github.com > /root/.ssh/known_hosts kubectl -n homeassistant create secret generic git-creds \ --from-file=id_rsa=/root/.ssh/id_rsa \ --from-file=known_hosts=/root/.ssh/known_hosts \ --from-file=id_rsa.pub=/root/.ssh/id_rsa.pub