refactor(charts): BREAKING CHANGE (#2836)

* Update Apps with new Common version

* Patch with the secret fixes from common

* fix amd
This commit is contained in:
Kjeld Schouten-Lebbing
2022-06-07 19:41:19 +02:00
committed by GitHub
parent e4911cf0b1
commit 5529c2a3af
1546 changed files with 10467 additions and 3650 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ appVersion: "2022.6.1"
dependencies:
- name: common
repository: https://library-charts.truecharts.org
version: 9.3.24
version: 10.0.8
- condition: postgresql.enabled
name: postgresql
repository: https://charts.truecharts.org/
@@ -26,7 +26,7 @@ sources:
- https://github.com/home-assistant/home-assistant
- https://github.com/cdr/code-server
type: application
version: 13.0.41
version: 14.0.0
annotations:
truecharts.org/catagories: |
- home-automation
@@ -0,0 +1,21 @@
#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
values.update({
**({'secretEnv': values['secret']} if values.get('secret') else {}),
**({'secret': {}} if values.get('secret'))
})
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))
@@ -74,23 +74,6 @@ questions:
- value: "OnDelete"
description: "(Legacy) OnDelete: ignore .spec.template changes"
# Include{controllerExpert}
- variable: git
group: "Container Configuration"
label: "Home-Assistant Git Settings"
schema:
additional_attrs: true
type: dict
attrs:
- variable: deployKey
label: "Git deploy key"
schema:
type: string
default: ""
- variable: deployKeyBase64
label: "Git KeyBase64 deploy key"
schema:
type: string
default: ""
# Include{containerConfig}
- variable: service
@@ -1,90 +0,0 @@
{{/* Define the configmap */}}
{{- define "hass.configmap" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-init
data:
init.sh: |-
#!/bin/sh
if test -f "/config/configuration.yaml"; then
echo "configuration.yaml exists."
if grep -q recorder: "/config/configuration.yaml"; then
echo "configuration.yaml already contains recorder"
else
cat /config/init/recorder.default >> /config/configuration.yaml
fi
if grep -q http: "/config/configuration.yaml"; then
echo "configuration.yaml already contains http section"
else
cat /config/init/http.default >> /config/configuration.yaml
fi
else
echo "configuration.yaml does NOT exist."
cp /config/init/configuration.yaml.default /config/configuration.yaml
cat /config/init/recorder.default >> /config/configuration.yaml
cat /config/init/http.default >> /config/configuration.yaml
fi
echo "Creating include files..."
for include_file in groups.yaml automations.yaml scripts.yaml scenes.yaml; do
if test -f "/config/$include_file"; then
echo "$include_file exists."
else
echo "$include_file does NOT exist."
touch "/config/$include_file"
fi
done
cd "/config" || echo "Could not change path to /config"
echo "Creating custom_components directory..."
mkdir "/config/custom_components" || echo "custom_components directory already exists"
echo "Changing to the custom_components directory..."
cd "/config/custom_components" || echo "Could not change path to /config/custom_components"
echo "Downloading HACS"
wget "https://github.com/hacs/integration/releases/latest/download/hacs.zip" || exit 0
if [ -d "/config/custom_components/hacs" ]; then
echo "HACS directory already exist, cleaning up..."
rm -R "/config/custom_components/hacs"
fi
echo "Creating HACS directory..."
mkdir "/config/custom_components/hacs"
echo "Unpacking HACS..."
unzip "/config/custom_components/hacs.zip" -d "/config/custom_components/hacs" >/dev/null 2>&1
echo "Removing HACS zip file..."
rm "/config/custom_components/hacs.zip"
echo "Installation complete."
configuration.yaml.default: |-
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
recorder.default: |-
recorder:
purge_keep_days: 30
commit_interval: 3
db_url: {{ ( printf "%s?client_encoding=utf8" ( .Values.postgresql.url.complete | trimAll "\"" ) ) | quote }}
http.default: |-
http:
use_x_forwarded_for: true
trusted_proxies:
- 172.16.0.0/16
{{- end -}}
@@ -1,22 +1,5 @@
{{/* Make sure all variables are set properly */}}
{{- include "common.setup" . }}
{{/* Render configmap for hass */}}
{{- include "hass.configmap" . }}
{{/* Append the general secret volumes to the volumes */}}
{{- define "hass.initvolume" -}}
enabled: "true"
mountPath: "/config/init"
readOnly: true
type: "custom"
volumeSpec:
configMap:
name: {{ include "common.names.fullname" . }}-init
defaultMode: 0777
{{- end -}}
{{- $_ := set .Values.persistence "init" (include "hass.initvolume" . | fromYaml) -}}
{{- include "tc.common.loader.init" . }}
{{/* Render the templates */}}
{{ include "common.postSetup" . }}
{{ include "tc.common.loader.apply" . }}
@@ -1,15 +0,0 @@
{{- if or .Values.git.deployKey .Values.git.deployKeyBase64 }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "common.names.fullname" . }}-deploykey
labels:
{{- include "common.labels" . | nindent 4 }}
type: Opaque
data:
{{- if .Values.git.deployKey }}
id_rsa: {{ .Values.git.deployKey | b64enc | quote }}
{{- else }}
id_rsa: {{ .Values.git.deployKeyBase64 | quote }}
{{- end }}
{{- end }}
+95 -7
View File
@@ -1,7 +1,7 @@
image:
repository: tccr.io/truecharts/home-assistant
pullPolicy: IfNotPresent
tag: v2022.6.1@sha256:5c97229d5ce59666fa71cede2b3f140f9f0e2a8cd7307b4e71cdc27e5f9d8b24
tag: v2022.6.2@sha256:7b9b262861c0f252ba33c1d24a0cad06eb657cb22a78089f4ecfc368abf250e9
securityContext:
readOnlyRootFilesystem: false
@@ -34,12 +34,6 @@ initContainers:
# # When hostNetwork is true set dnsPolicy to ClusterFirstWithHostNet
# dnsPolicy: ClusterFirstWithHostNet
# Allow access a Git repository by passing in a private SSH key
git:
# Raw SSH private key
deployKey: ""
# Base64-encoded SSH private key. When both variables are set, the raw SSH key takes precedence.
deployKeyBase64: ""
# Enable a prometheus-operator servicemonitor
prometheus:
@@ -52,8 +46,102 @@ persistence:
config:
enabled: true
mountPath: "/config"
init:
enabled: "true"
mountPath: "/config/init"
readOnly: true
type: "custom"
volumeSpec:
configMap:
name: '{{ include "tc.common.names.fullname" . }}-init'
defaultMode: 0777
configmap:
init:
enabled: true
data:
init.sh: |-
#!/bin/sh
if test -f "/config/configuration.yaml"; then
echo "configuration.yaml exists."
if grep -q recorder: "/config/configuration.yaml"; then
echo "configuration.yaml already contains recorder"
else
cat /config/init/recorder.default >> /config/configuration.yaml
fi
if grep -q http: "/config/configuration.yaml"; then
echo "configuration.yaml already contains http section"
else
cat /config/init/http.default >> /config/configuration.yaml
fi
else
echo "configuration.yaml does NOT exist."
cp /config/init/configuration.yaml.default /config/configuration.yaml
cat /config/init/recorder.default >> /config/configuration.yaml
cat /config/init/http.default >> /config/configuration.yaml
fi
echo "Creating include files..."
for include_file in groups.yaml automations.yaml scripts.yaml scenes.yaml; do
if test -f "/config/$include_file"; then
echo "$include_file exists."
else
echo "$include_file does NOT exist."
touch "/config/$include_file"
fi
done
cd "/config" || echo "Could not change path to /config"
echo "Creating custom_components directory..."
mkdir "/config/custom_components" || echo "custom_components directory already exists"
echo "Changing to the custom_components directory..."
cd "/config/custom_components" || echo "Could not change path to /config/custom_components"
echo "Downloading HACS"
wget "https://github.com/hacs/integration/releases/latest/download/hacs.zip" || exit 0
if [ -d "/config/custom_components/hacs" ]; then
echo "HACS directory already exist, cleaning up..."
rm -R "/config/custom_components/hacs"
fi
echo "Creating HACS directory..."
mkdir "/config/custom_components/hacs"
echo "Unpacking HACS..."
unzip "/config/custom_components/hacs.zip" -d "/config/custom_components/hacs" >/dev/null 2>&1
echo "Removing HACS zip file..."
rm "/config/custom_components/hacs.zip"
echo "Installation complete."
configuration.yaml.default: |-
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
recorder.default: |-
recorder:
purge_keep_days: 30
commit_interval: 3
db_url: {{ ( printf "%s?client_encoding=utf8" ( .Values.postgresql.url.complete | trimAll "\"" ) ) | quote }}
http.default: |-
http:
use_x_forwarded_for: true
trusted_proxies:
- 172.16.0.0/16
# -- Enable and configure postgresql database subchart under this key.
# For more options see [postgresql chart documentation](https://github.com/tccr.io/truecharts/charts/tree/master/tccr.io/truecharts/postgresql)
# @default -- See values.yaml