Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: install esphome #1619

Merged
merged 1 commit into from
Nov 21, 2024
Merged

feat: install esphome #1619

merged 1 commit into from
Nov 21, 2024

Conversation

martinohmann
Copy link
Owner

No description provided.

@github-actions github-actions bot added area/kubernetes Changes made in the kubernetes directory area/terraform Changes made in the terraform directory cluster/main labels Nov 21, 2024
Copy link

github-actions bot commented Nov 21, 2024

kustomization changes in kubernetes/main

--- kubernetes/main/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/esphome

+++ kubernetes/main/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/esphome

@@ -0,0 +1,41 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: esphome
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: esphome
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  dependsOn:
+  - name: longhorn
+  - name: volsync
+  interval: 2h
+  path: ./kubernetes/main/apps/default/esphome/app
+  postBuild:
+    substitute:
+      APP: esphome
+      VOLSYNC_ACCESSMODES: ReadWriteOnce
+      VOLSYNC_CAPACITY: 5Gi
+      VOLSYNC_SCHEDULE_B2: 55 2 * * 0
+      VOLSYNC_SCHEDULE_MINIO: 55 2 * * *
+    substituteFrom:
+    - kind: Secret
+      name: cluster-secrets
+  prune: true
+  retryInterval: 1m
+  sourceRef:
+    kind: GitRepository
+    name: home-kubernetes
+  targetNamespace: default
+  timeout: 5m
+  wait: false
+
--- kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome PersistentVolumeClaim: default/esphome

+++ kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome PersistentVolumeClaim: default/esphome

@@ -0,0 +1,22 @@

+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  labels:
+    app.kubernetes.io/name: esphome
+    kustomize.toolkit.fluxcd.io/name: esphome
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: esphome
+  namespace: default
+spec:
+  accessModes:
+  - ReadWriteOnce
+  dataSourceRef:
+    apiGroup: volsync.backube
+    kind: ReplicationDestination
+    name: esphome-dst
+  resources:
+    requests:
+      storage: 5Gi
+  storageClassName: longhorn
+
--- kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome ReplicationSource: default/esphome

+++ kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome ReplicationSource: default/esphome

@@ -0,0 +1,36 @@

+---
+apiVersion: volsync.backube/v1alpha1
+kind: ReplicationSource
+metadata:
+  labels:
+    app.kubernetes.io/name: esphome
+    kustomize.toolkit.fluxcd.io/name: esphome
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: esphome
+  namespace: default
+spec:
+  restic:
+    accessModes:
+    - ReadWriteOnce
+    cacheAccessModes:
+    - ReadWriteOnce
+    cacheCapacity: 1Gi
+    cacheStorageClassName: openebs-hostpath
+    copyMethod: Snapshot
+    moverSecurityContext:
+      fsGroup: 568
+      runAsGroup: 568
+      runAsUser: 568
+    pruneIntervalDays: 7
+    repository: esphome-volsync
+    retain:
+      daily: 7
+      hourly: 24
+      monthly: 6
+      weekly: 4
+    storageClassName: longhorn
+    volumeSnapshotClassName: longhorn
+  sourcePVC: esphome
+  trigger:
+    schedule: 55 2 * * *
+
--- kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome ReplicationDestination: default/esphome-dst

+++ kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome ReplicationDestination: default/esphome-dst

@@ -0,0 +1,30 @@

+---
+apiVersion: volsync.backube/v1alpha1
+kind: ReplicationDestination
+metadata:
+  labels:
+    app.kubernetes.io/name: esphome
+    kustomize.toolkit.fluxcd.io/name: esphome
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: esphome-dst
+  namespace: default
+spec:
+  restic:
+    accessModes:
+    - ReadWriteOnce
+    cacheAccessModes:
+    - ReadWriteOnce
+    cacheCapacity: 1Gi
+    cacheStorageClassName: openebs-hostpath
+    capacity: 5Gi
+    copyMethod: Snapshot
+    moverSecurityContext:
+      fsGroup: 568
+      runAsGroup: 568
+      runAsUser: 568
+    repository: esphome-volsync
+    storageClassName: longhorn
+    volumeSnapshotClassName: longhorn
+  trigger:
+    manual: restore-once
+
--- kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome ReplicationSource: default/esphome-b2

+++ kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome ReplicationSource: default/esphome-b2

@@ -0,0 +1,34 @@

+---
+apiVersion: volsync.backube/v1alpha1
+kind: ReplicationSource
+metadata:
+  labels:
+    app.kubernetes.io/name: esphome
+    kustomize.toolkit.fluxcd.io/name: esphome
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: esphome-b2
+  namespace: default
+spec:
+  restic:
+    accessModes:
+    - ReadWriteOnce
+    cacheAccessModes:
+    - ReadWriteOnce
+    cacheCapacity: 1Gi
+    cacheStorageClassName: openebs-hostpath
+    copyMethod: Snapshot
+    moverSecurityContext:
+      fsGroup: 568
+      runAsGroup: 568
+      runAsUser: 568
+    pruneIntervalDays: 7
+    repository: esphome-b2-volsync
+    retain:
+      daily: 7
+      weekly: 4
+    storageClassName: longhorn
+    volumeSnapshotClassName: longhorn
+  sourcePVC: esphome
+  trigger:
+    schedule: 55 2 * * 0
+
--- kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome HelmRelease: default/esphome

+++ kubernetes/main/apps/default/esphome/app Kustomization: flux-system/esphome HelmRelease: default/esphome

@@ -0,0 +1,150 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2beta2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: esphome
+    kustomize.toolkit.fluxcd.io/name: esphome
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: esphome
+  namespace: default
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s
+        namespace: flux-system
+      version: 3.5.1
+  install:
+    remediation:
+      retries: 3
+  interval: 2h
+  uninstall:
+    keepHistory: false
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+  values:
+    controllers:
+      esphome:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          app:
+            env:
+              PLATFORMIO_CORE_DIR: .platformio
+              PLATFORMIO_GLOBALLIB_DIR: .platformiolibs
+            image:
+              repository: ghcr.io/esphome/esphome
+              tag: 2024.11.0@sha256:4d822f615c463c599db5240600faf481986a53d4333e94822efa194f26c725f9
+            probes:
+              liveness:
+                enabled: true
+              readiness:
+                enabled: true
+              startup:
+                enabled: true
+                spec:
+                  failureThreshold: 30
+                  periodSeconds: 5
+            resources:
+              limits:
+                memory: 1Gi
+              requests:
+                cpu: 10m
+                memory: 400Mi
+          code:
+            args:
+            - --auth
+            - none
+            - --user-data-dir
+            - /config/.vscode
+            - --extensions-dir
+            - /config/.vscode
+            - --port
+            - '80'
+            - /config
+            image:
+              repository: ghcr.io/coder/code-server
+              tag: 4.95.3@sha256:6d74583d68179cbb6ddadc2518b450d2ac3eaec2d342474fe1941e03371cd2cf
+            resources:
+              limits:
+                memory: 1Gi
+              requests:
+                cpu: 10m
+                memory: 128Mi
+    defaultPodOptions:
+      securityContext:
+        fsGroup: 100
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+        seccompProfile:
+          type: RuntimeDefault
+    ingress:
+      app:
+        annotations:
+          gethomepage.dev/enabled: 'true'
+          gethomepage.dev/group: Automation
+          gethomepage.dev/icon: esphome.png
+          gethomepage.dev/name: ESPHome
+          gethomepage.dev/pod-selector: app.kubernetes.io/name=esphome
+        className: internal
+        hosts:
+        - host: esphome.18b.haus
+          paths:
+          - path: /
+            service:
+              identifier: app
+              port: http
+        tls:
+        - hosts:
+          - esphome.18b.haus
+      code:
+        annotations:
+          gethomepage.dev/enabled: 'true'
+          gethomepage.dev/group: Automation
+          gethomepage.dev/icon: vscode.png
+          gethomepage.dev/name: ESPHome Code
+          gethomepage.dev/pod-selector: app.kubernetes.io/name=esphome
+          nginx.ingress.kubernetes.io/auth-response-headers: Set-Cookie,X-authentik-username,X-authentik-groups,X-authentik-email,X-authentik-name,X-authentik-uid
+          nginx.ingress.kubernetes.io/auth-signin: https://esphome-code.18b.haus/outpost.goauthentik.io/start?rd=$escaped_request_uri
+          nginx.ingress.kubernetes.io/auth-snippet: |
+            proxy_set_header X-Forwarded-Host $http_host;
+          nginx.ingress.kubernetes.io/auth-url: http://authentik-outpost-proxy.identity.svc.cluster.local:9000/outpost.goauthentik.io/auth/nginx
+        className: internal
+        hosts:
+        - host: esphome-code.18b.haus
+          paths:
+          - path: /
+            service:
+              identifier: code
+              port: http
+        tls:
+        - hosts:
+          - esphome-code.18b.haus
+    persistence:
+      cache:
+        globalMounts:
+        - path: /config/.esphome
+        type: emptyDir
+      config:
+        existingClaim: esphome
+        globalMounts:
+        - path: /config
+    service:
+      app:
+        controller: esphome
+        ports:
+          http:
+            port: 6052
+      code:
+        controller: esphome
+        ports:
+          http:
+            port: 80
+

Copy link

github-actions bot commented Nov 21, 2024

helmrelease changes in kubernetes/main

--- HelmRelease: default/esphome Service: default/esphome-app

+++ HelmRelease: default/esphome Service: default/esphome-app

@@ -0,0 +1,22 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: esphome-app
+  labels:
+    app.kubernetes.io/instance: esphome
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: esphome
+    app.kubernetes.io/service: esphome-app
+spec:
+  type: ClusterIP
+  ports:
+  - port: 6052
+    targetPort: 6052
+    protocol: TCP
+    name: http
+  selector:
+    app.kubernetes.io/component: esphome
+    app.kubernetes.io/instance: esphome
+    app.kubernetes.io/name: esphome
+
--- HelmRelease: default/esphome Service: default/esphome-code

+++ HelmRelease: default/esphome Service: default/esphome-code

@@ -0,0 +1,22 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: esphome-code
+  labels:
+    app.kubernetes.io/instance: esphome
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: esphome
+    app.kubernetes.io/service: esphome-code
+spec:
+  type: ClusterIP
+  ports:
+  - port: 80
+    targetPort: 80
+    protocol: TCP
+    name: http
+  selector:
+    app.kubernetes.io/component: esphome
+    app.kubernetes.io/instance: esphome
+    app.kubernetes.io/name: esphome
+
--- HelmRelease: default/esphome Deployment: default/esphome

+++ HelmRelease: default/esphome Deployment: default/esphome

@@ -0,0 +1,114 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: esphome
+  labels:
+    app.kubernetes.io/component: esphome
+    app.kubernetes.io/instance: esphome
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: esphome
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: esphome
+      app.kubernetes.io/name: esphome
+      app.kubernetes.io/instance: esphome
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: esphome
+        app.kubernetes.io/instance: esphome
+        app.kubernetes.io/name: esphome
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      securityContext:
+        fsGroup: 100
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+        seccompProfile:
+          type: RuntimeDefault
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      containers:
+      - env:
+        - name: PLATFORMIO_CORE_DIR
+          value: .platformio
+        - name: PLATFORMIO_GLOBALLIB_DIR
+          value: .platformiolibs
+        image: ghcr.io/esphome/esphome:2024.11.0@sha256:4d822f615c463c599db5240600faf481986a53d4333e94822efa194f26c725f9
+        livenessProbe:
+          failureThreshold: 3
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          tcpSocket:
+            port: 80
+          timeoutSeconds: 1
+        name: app
+        readinessProbe:
+          failureThreshold: 3
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          tcpSocket:
+            port: 6052
+          timeoutSeconds: 1
+        resources:
+          limits:
+            memory: 1Gi
+          requests:
+            cpu: 10m
+            memory: 400Mi
+        startupProbe:
+          failureThreshold: 30
+          initialDelaySeconds: 0
+          periodSeconds: 5
+          tcpSocket:
+            port: 6052
+          timeoutSeconds: 1
+        volumeMounts:
+        - mountPath: /config/.esphome
+          name: cache
+        - mountPath: /config
+          name: config
+      - args:
+        - --auth
+        - none
+        - --user-data-dir
+        - /config/.vscode
+        - --extensions-dir
+        - /config/.vscode
+        - --port
+        - '80'
+        - /config
+        image: ghcr.io/coder/code-server:4.95.3@sha256:6d74583d68179cbb6ddadc2518b450d2ac3eaec2d342474fe1941e03371cd2cf
+        name: code
+        resources:
+          limits:
+            memory: 1Gi
+          requests:
+            cpu: 10m
+            memory: 128Mi
+        volumeMounts:
+        - mountPath: /config/.esphome
+          name: cache
+        - mountPath: /config
+          name: config
+      volumes:
+      - emptyDir: {}
+        name: cache
+      - name: config
+        persistentVolumeClaim:
+          claimName: esphome
+
--- HelmRelease: default/esphome Ingress: default/esphome-app

+++ HelmRelease: default/esphome Ingress: default/esphome-app

@@ -0,0 +1,32 @@

+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: esphome-app
+  labels:
+    app.kubernetes.io/instance: esphome
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: esphome
+  annotations:
+    gethomepage.dev/enabled: 'true'
+    gethomepage.dev/group: Automation
+    gethomepage.dev/icon: esphome.png
+    gethomepage.dev/name: ESPHome
+    gethomepage.dev/pod-selector: app.kubernetes.io/name=esphome
+spec:
+  ingressClassName: internal
+  tls:
+  - hosts:
+    - esphome.18b.haus
+  rules:
+  - host: esphome.18b.haus
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: esphome-app
+            port:
+              number: 6052
+
--- HelmRelease: default/esphome Ingress: default/esphome-code

+++ HelmRelease: default/esphome Ingress: default/esphome-code

@@ -0,0 +1,37 @@

+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: esphome-code
+  labels:
+    app.kubernetes.io/instance: esphome
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: esphome
+  annotations:
+    gethomepage.dev/enabled: 'true'
+    gethomepage.dev/group: Automation
+    gethomepage.dev/icon: vscode.png
+    gethomepage.dev/name: ESPHome Code
+    gethomepage.dev/pod-selector: app.kubernetes.io/name=esphome
+    nginx.ingress.kubernetes.io/auth-response-headers: Set-Cookie,X-authentik-username,X-authentik-groups,X-authentik-email,X-authentik-name,X-authentik-uid
+    nginx.ingress.kubernetes.io/auth-signin: https://esphome-code.18b.haus/outpost.goauthentik.io/start?rd=$escaped_request_uri
+    nginx.ingress.kubernetes.io/auth-snippet: |
+      proxy_set_header X-Forwarded-Host $http_host;
+    nginx.ingress.kubernetes.io/auth-url: http://authentik-outpost-proxy.identity.svc.cluster.local:9000/outpost.goauthentik.io/auth/nginx
+spec:
+  ingressClassName: internal
+  tls:
+  - hosts:
+    - esphome-code.18b.haus
+  rules:
+  - host: esphome-code.18b.haus
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: esphome-code
+            port:
+              number: 80
+

@martinohmann martinohmann merged commit 9130eb5 into main Nov 21, 2024
7 checks passed
@martinohmann martinohmann deleted the esphome/install branch November 21, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Changes made in the kubernetes directory area/terraform Changes made in the terraform directory cluster/main
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant