Add standalone chart for homeassistant.
All checks were successful
ci/woodpecker/push/homeassistant Pipeline was successful
All checks were successful
ci/woodpecker/push/homeassistant Pipeline was successful
This commit is contained in:
parent
166a9fe94b
commit
5a290383ad
10 changed files with 418 additions and 0 deletions
13
.woodpecker/homeassistant.yaml
Normal file
13
.woodpecker/homeassistant.yaml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
when:
|
||||||
|
path: "charts/homeassistant/**"
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pipeline:
|
||||||
|
package:
|
||||||
|
image: "docker.io/alpine/helm:latest"
|
||||||
|
secrets: [helm_user, helm_password, helm_repo]
|
||||||
|
commands:
|
||||||
|
- helm plugin install https://github.com/chartmuseum/helm-push
|
||||||
|
- helm repo add therepo $HELM_REPO --username $HELM_USER --password $HELM_PASSWORD
|
||||||
|
- helm cm-push charts/homeassistant therepo
|
23
charts/homeassistant/.helmignore
Normal file
23
charts/homeassistant/.helmignore
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
24
charts/homeassistant/Chart.yaml
Normal file
24
charts/homeassistant/Chart.yaml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
apiVersion: v2
|
||||||
|
name: homeassistant
|
||||||
|
description: A Helm chart for Kubernetes
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "1.16.0"
|
62
charts/homeassistant/templates/_helpers.tpl
Normal file
62
charts/homeassistant/templates/_helpers.tpl
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "homeassistant.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 "homeassistant.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 "homeassistant.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "homeassistant.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "homeassistant.chart" . }}
|
||||||
|
{{ include "homeassistant.selectorLabels" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "homeassistant.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "homeassistant.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "homeassistant.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "homeassistant.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
22
charts/homeassistant/templates/certificate.yaml
Normal file
22
charts/homeassistant/templates/certificate.yaml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{{- if .Values.cert.dnsNames }}
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
secretName: {{ include "homeassistant.fullname" . }}-cert-secret
|
||||||
|
secretTemplate:
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 6 }}
|
||||||
|
duration: 2160h
|
||||||
|
renewBefore: 360h
|
||||||
|
dnsNames:
|
||||||
|
{{- range .Values.cert.dnsNames }}
|
||||||
|
- {{ . | quote}}
|
||||||
|
{{- end }}
|
||||||
|
issuerRef:
|
||||||
|
name: {{ .Values.cert.issuerName }}
|
||||||
|
kind: ClusterIssuer
|
||||||
|
{{- end }}
|
18
charts/homeassistant/templates/configmap-init.yaml
Normal file
18
charts/homeassistant/templates/configmap-init.yaml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-initscript
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
init.py: |
|
||||||
|
import pathlib
|
||||||
|
# Symlink some paths to move them outside the config volume.
|
||||||
|
paths = {"/config/.storage": "/media/storage", "/config/configuration.yaml": "/media/configuration/configuration.yaml"}
|
||||||
|
for from_p, to in paths.items():
|
||||||
|
try:
|
||||||
|
from_path = pathlib.Path(from_p)
|
||||||
|
from_path.symlink_to(to)
|
||||||
|
print(f'Created {from_p} -> {to}')
|
||||||
|
except FileExistsError:
|
||||||
|
print(f'{from_p} -> {to} link already existed.')
|
30
charts/homeassistant/templates/configmap.yaml
Normal file
30
charts/homeassistant/templates/configmap.yaml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-configuration
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
configuration.yaml: |
|
||||||
|
homeassistant:
|
||||||
|
{{- range $key, $value := .Values.config.homeassistant }}
|
||||||
|
{{ printf "%s: %s" $key ($value | quote) }}
|
||||||
|
{{- end }}
|
||||||
|
packages: !include_dir_named /media/packages
|
||||||
|
default_config:
|
||||||
|
automation: !include automations.yaml
|
||||||
|
script: !include scripts.yaml
|
||||||
|
scene: !include scenes.yaml
|
||||||
|
{{ .Values.mainConfig | toYaml | nindent 4 }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-packages
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
{{- range $key, $value := fromYaml .Values.config.packages }}
|
||||||
|
"{{ $key }}": |
|
||||||
|
{{- $value | toYaml | nindent 4 }}
|
||||||
|
{{- end }}
|
122
charts/homeassistant/templates/deployment.yaml
Normal file
122
charts/homeassistant/templates/deployment.yaml
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
hass.kube.a09.uk/automationService: homeassistant
|
||||||
|
{{- include "homeassistant.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
checksum/initConfig: {{ include (print $.Template.BasePath "/configmap-init.yaml") . | sha256sum }}
|
||||||
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
hass.kube.a09.uk/automationService: homeassistant
|
||||||
|
{{- include "homeassistant.selectorLabels" . | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
priorityClassName: {{ .Values.priorityClassName }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}-homeassistant
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
args:
|
||||||
|
- 'python3'
|
||||||
|
- '-m'
|
||||||
|
- 'homeassistant'
|
||||||
|
- '--config'
|
||||||
|
- '/config'
|
||||||
|
- '--log-file'
|
||||||
|
- '/tmp/home-assistant.log'
|
||||||
|
ports:
|
||||||
|
- name: https
|
||||||
|
containerPort: 443
|
||||||
|
protocol: TCP
|
||||||
|
#startupProbe:
|
||||||
|
# httpGet:
|
||||||
|
# path: /
|
||||||
|
# port: https
|
||||||
|
# failureThreshold: 30
|
||||||
|
#livenessProbe:
|
||||||
|
# httpGet:
|
||||||
|
# path: /
|
||||||
|
# port: https
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: storage
|
||||||
|
mountPath: /media/storage
|
||||||
|
- name: certificate-secret
|
||||||
|
mountPath: /media/certificates
|
||||||
|
- name: main-configmap
|
||||||
|
mountPath: /media/configuration
|
||||||
|
- name: packages-configmap
|
||||||
|
mountPath: /media/packages
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
initContainers:
|
||||||
|
- name: init
|
||||||
|
image: docker.io/python
|
||||||
|
command: ['python', '-u', '/init/init.py']
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: init
|
||||||
|
mountPath: /init
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ include "homeassistant.fullname" . }}-config
|
||||||
|
- name: storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ include "homeassistant.fullname" . }}-storage
|
||||||
|
- name: init
|
||||||
|
configMap:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-initscript
|
||||||
|
- name: certificate-secret
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "homeassistant.fullname" . }}-cert-secret
|
||||||
|
- name: main-configmap
|
||||||
|
configMap:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-configuration
|
||||||
|
- name: packages-configmap
|
||||||
|
configMap:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-packages
|
35
charts/homeassistant/templates/pvc.yaml
Normal file
35
charts/homeassistant/templates/pvc.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{{- if not .Values.pvc.config.existingClaim -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-config
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
helm.sh/resource-policy: "keep"
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
storageClassName: {{ .Values.pvc.config.storageClassName | quote }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.pvc.config.storage | quote }}
|
||||||
|
{{- end }}
|
||||||
|
---
|
||||||
|
{{- if not .Values.pvc.storage.existingClaim -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ include "homeassistant.fullname" . }}-storage
|
||||||
|
labels:
|
||||||
|
{{- include "homeassistant.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
helm.sh/resource-policy: "keep"
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
storageClassName: {{ .Values.pvc.storage.storageClassName | quote }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.pvc.storage.storage | quote }}
|
||||||
|
{{- end }}
|
69
charts/homeassistant/values.yaml
Normal file
69
charts/homeassistant/values.yaml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# Default values for esphome.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
image:
|
||||||
|
repository: ghcr.io/home-assistant/home-assistant
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: ""
|
||||||
|
|
||||||
|
imagePullSecrets: []
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
podSecurityContext: {}
|
||||||
|
# fsGroup: 2000
|
||||||
|
|
||||||
|
securityContext: {}
|
||||||
|
# capabilities:
|
||||||
|
# drop:
|
||||||
|
# - ALL
|
||||||
|
# readOnlyRootFilesystem: true
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 1000
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
host: ""
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
||||||
|
|
||||||
|
pvc:
|
||||||
|
config:
|
||||||
|
existingClaim: false
|
||||||
|
storageClassName: ""
|
||||||
|
storage: "1Gi"
|
||||||
|
storage:
|
||||||
|
existingClaim: false
|
||||||
|
storageClassName: ""
|
||||||
|
storage: "5Gi"
|
||||||
|
|
||||||
|
mainConfig:
|
||||||
|
http:
|
||||||
|
server_port: 443
|
||||||
|
ssl_certificate: /media/certificates/tls.crt
|
||||||
|
ssl_key: /media/certificates/tls.key
|
||||||
|
use_x_forwarded_for: true
|
||||||
|
config:
|
||||||
|
packages: ""
|
||||||
|
|
||||||
|
cert:
|
||||||
|
dnsNames: []
|
||||||
|
issuerName: ""
|
Loading…
Reference in a new issue