diff --git a/kubernetes/apps/default/home-assistant/app/externalsecret.yaml b/kubernetes/apps/default/home-assistant/app/externalsecret.yaml new file mode 100644 index 00000000..bf6e1b7a --- /dev/null +++ b/kubernetes/apps/default/home-assistant/app/externalsecret.yaml @@ -0,0 +1,26 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/external-secrets.io/externalsecret_v1beta1.json +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: home-assistant +spec: + secretStoreRef: + kind: ClusterSecretStore + name: onepassword-connect + target: + name: home-assistant-secret + creationPolicy: Owner + template: + engineVersion: v2 + data: + HASS_ELEVATION: "{{ .hass_elevation }}" + HASS_LATITUDE: "{{ .hass_latitude }}" + HASS_LONGITUDE: "{{ .hass_longitude }}" + dataFrom: + - extract: + key: home-assistant + rewrite: + - regexp: + source: "(.*)" + target: "hass_$1" \ No newline at end of file diff --git a/kubernetes/apps/default/home-assistant/app/helmrelease.yaml b/kubernetes/apps/default/home-assistant/app/helmrelease.yaml new file mode 100644 index 00000000..4b5cb017 --- /dev/null +++ b/kubernetes/apps/default/home-assistant/app/helmrelease.yaml @@ -0,0 +1,99 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json +apiVersion: helm.toolkit.fluxcd.io/v2beta2 +kind: HelmRelease +metadata: + name: home-assistant +spec: + interval: 30m + chart: + spec: + chart: app-template + version: 3.1.0 + sourceRef: + kind: HelmRepository + name: bjw-s + namespace: flux-system + install: + remediation: + retries: 3 + upgrade: + cleanupOnFail: true + remediation: + strategy: rollback + retries: 3 + dependsOn: + - name: rook-ceph-cluster + namespace: rook-ceph + - name: volsync + namespace: volsync-system + values: + controllers: + home-assistant: + annotations: + reloader.stakater.com/auto: "true" + pod: + annotations: + k8s.v1.cni.cncf.io/networks: | + [{ + "name":"multus-iot", + "namespace": "network", + "ips": ["10.1.3.151/24"] + }] + securityContext: + runAsUser: 568 + runAsGroup: 568 + runAsNonRoot: true + fsGroup: 568 + fsGroupChangePolicy: OnRootMismatch + containers: + app: + image: + repository: ghcr.io/onedr0p/home-assistant + tag: 2024.4.3@sha256:393ff4d7da4af9f5766d409754257afa6baecb8944f6788dc3da53e9ae659dd8 + env: + TZ: America/Chicago + HASS_HTTP_TRUSTED_PROXY_1: 10.244.0.0/16 + envFrom: + - secretRef: + name: home-assistant-secret + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: { drop: ["ALL"] } + resources: + requests: + cpu: 10m + limits: + memory: 1Gi + service: + app: + controller: home-assistant + ports: + http: + port: 8123 + ingress: + app: + className: internal-nginx + hosts: + - host: &host hass.jahanson.tech + paths: + - path: / + service: + identifier: app + port: http + tls: + - hosts: [*host] + persistence: + config: + existingClaim: home-assistant + logs: + type: emptyDir + globalMounts: + - path: /config/logs + tts: + type: emptyDir + globalMounts: + - path: /config/tts + tmp: + type: emptyDir \ No newline at end of file diff --git a/kubernetes/apps/default/home-assistant/app/kustomization.yaml b/kubernetes/apps/default/home-assistant/app/kustomization.yaml new file mode 100644 index 00000000..f558283b --- /dev/null +++ b/kubernetes/apps/default/home-assistant/app/kustomization.yaml @@ -0,0 +1,8 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./externalsecret.yaml + - ./helmrelease.yaml + - ../../../../templates/volsync \ No newline at end of file diff --git a/kubernetes/apps/default/home-assistant/ks.yaml b/kubernetes/apps/default/home-assistant/ks.yaml new file mode 100644 index 00000000..cb89ce85 --- /dev/null +++ b/kubernetes/apps/default/home-assistant/ks.yaml @@ -0,0 +1,27 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app home-assistant + namespace: flux-system +spec: + targetNamespace: default + commonMetadata: + labels: + app.kubernetes.io/name: *app + dependsOn: + - name: external-secrets-stores + path: ./kubernetes/main/apps/default/home-assistant/app + prune: true + sourceRef: + kind: GitRepository + name: homelab + wait: false + interval: 30m + retryInterval: 1m + timeout: 5m + postBuild: + substitute: + APP: *app + VOLSYNC_CAPACITY: 5Gi \ No newline at end of file