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

migrate zigbee #3422

Merged
merged 2 commits into from
Jun 24, 2024
Merged

migrate zigbee #3422

merged 2 commits into from
Jun 24, 2024

Conversation

blackjid
Copy link
Owner

  • feat(media/zigbee): move from archive to migrate
  • feat(media/zigbee): migrate zigbee

@bot-x-mod
Copy link
Contributor

bot-x-mod bot commented Jun 24, 2024

--- kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/zigbee2mqtt

+++ kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/zigbee2mqtt

@@ -0,0 +1,46 @@

+---
+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: zigbee2mqtt
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: zigbee2mqtt
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  dependsOn:
+  - name: emqx-cluster
+  - name: external-secrets-stores
+  interval: 30m
+  path: ./kubernetes/apps/home/zigbee2mqtt/app
+  postBuild:
+    substitute:
+      APP: zigbee2mqtt
+      VOLSYNC_CAPACITY: 1Gi
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-settings
+    - kind: Secret
+      name: cluster-secrets
+    - kind: ConfigMap
+      name: cluster-user-settings
+      optional: true
+    - kind: Secret
+      name: cluster-user-secrets
+      optional: true
+  prune: true
+  retryInterval: 1m
+  sourceRef:
+    kind: GitRepository
+    name: home-kubernetes
+  targetNamespace: home
+  timeout: 5m
+  wait: false
+
--- kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt ExternalSecret: home/zigbee2mqtt

+++ kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt ExternalSecret: home/zigbee2mqtt

@@ -0,0 +1,33 @@

+---
+apiVersion: external-secrets.io/v1beta1
+kind: ExternalSecret
+metadata:
+  labels:
+    app.kubernetes.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zigbee2mqtt
+  namespace: home
+spec:
+  dataFrom:
+  - extract:
+      key: emqx
+  - extract:
+      key: zigbee2mqtt
+  secretStoreRef:
+    kind: ClusterSecretStore
+    name: onepassword-connect
+  target:
+    name: zigbee2mqtt-secret
+    template:
+      data:
+        ZIGBEE2MQTT_CONFIG_ADVANCED_EXT_PAN_ID: '{{ .ZIGBEE2MQTT_CONFIG_ADVANCED_EXT_PAN_ID
+          }}'
+        ZIGBEE2MQTT_CONFIG_ADVANCED_NETWORK_KEY: '{{ .ZIGBEE2MQTT_CONFIG_ADVANCED_NETWORK_KEY
+          }}'
+        ZIGBEE2MQTT_CONFIG_ADVANCED_PAN_ID: '{{ .ZIGBEE2MQTT_CONFIG_ADVANCED_PAN_ID
+          }}'
+        ZIGBEE2MQTT_CONFIG_MQTT_PASSWORD: '{{ .X_EMQX_MQTT_PASSWORD }}'
+        ZIGBEE2MQTT_CONFIG_MQTT_USER: '{{ .X_EMQX_MQTT_USERNAME }}'
+      engineVersion: v2
+
--- kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt HelmRelease: home/zigbee2mqtt

+++ kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt HelmRelease: home/zigbee2mqtt

@@ -0,0 +1,121 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zigbee2mqtt
+  namespace: home
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s
+        namespace: flux-system
+      version: 3.2.1
+  dependsOn:
+  - name: longhorn
+    namespace: longhorn-system
+  - name: volsync
+    namespace: volsync-system
+  install:
+    remediation:
+      retries: 3
+  interval: 30m
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+      strategy: rollback
+  values:
+    controllers:
+      zigbee2mqtt:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          app:
+            env:
+              TZ: America/Santiago
+              ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_DISCOVERY_TOPIC: homeassistant
+              ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_LEGACY_ENTITY_ATTRIBUTES: 'false'
+              ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_LEGACY_TRIGGERS: 'false'
+              ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_STATUS_TOPIC: homeassistant/status
+              ZIGBEE2MQTT_CONFIG_ADVANCED_LAST_SEEN: ISO_8601
+              ZIGBEE2MQTT_CONFIG_ADVANCED_LEGACY_API: 'false'
+              ZIGBEE2MQTT_CONFIG_ADVANCED_LEGACY_AVAILABILITY_PAYLOAD: 'false'
+              ZIGBEE2MQTT_CONFIG_ADVANCED_LOG_LEVEL: info
+              ZIGBEE2MQTT_CONFIG_ADVANCED_LOG_OUTPUT: '["console"]'
+              ZIGBEE2MQTT_CONFIG_AVAILABILITY_ACTIVE_TIMEOUT: 60
+              ZIGBEE2MQTT_CONFIG_AVAILABILITY_PASSIVE_TIMEOUT: 2000
+              ZIGBEE2MQTT_CONFIG_DEVICE_OPTIONS_LEGACY: 'false'
+              ZIGBEE2MQTT_CONFIG_DEVICE_OPTIONS_RETAIN: 'true'
+              ZIGBEE2MQTT_CONFIG_EXPERIMENTAL_NEW_API: 'true'
+              ZIGBEE2MQTT_CONFIG_FRONTEND_PORT: 80
+              ZIGBEE2MQTT_CONFIG_FRONTEND_URL: https://zigbee.donoso.family
+              ZIGBEE2MQTT_CONFIG_HOMEASSISTANT: 'true'
+              ZIGBEE2MQTT_CONFIG_MQTT_INCLUDE_DEVICE_INFORMATION: 'true'
+              ZIGBEE2MQTT_CONFIG_MQTT_KEEPALIVE: 60
+              ZIGBEE2MQTT_CONFIG_MQTT_REJECT_UNAUTHORIZED: 'true'
+              ZIGBEE2MQTT_CONFIG_MQTT_SERVER: mqtt://emqx-listeners.database.svc.cluster.local:1883
+              ZIGBEE2MQTT_CONFIG_MQTT_VERSION: 5
+              ZIGBEE2MQTT_CONFIG_PERMIT_JOIN: 'false'
+              ZIGBEE2MQTT_CONFIG_SERIAL_PORT: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
+              ZIGBEE2MQTT_DATA: /config
+            envFrom:
+            - secretRef:
+                name: zigbee2mqtt-secret
+            image:
+              repository: ghcr.io/koenkk/zigbee2mqtt
+              tag: 1.38.0@sha256:8a893949ab01ea25fe1189a02a24f7fee3d7e8717d0973bd3dd6989a3a45a6bf
+            probes:
+              liveness:
+                enabled: true
+              readiness:
+                enabled: true
+              startup:
+                enabled: true
+                spec:
+                  failureThreshold: 30
+                  periodSeconds: 10
+            resources:
+              limits:
+                memory: 512Mi
+              requests:
+                cpu: 10m
+            securityContext:
+              privileged: true
+        pod:
+          nodeSelector:
+            zzh.feature.node.kubernetes.io/zigbee: 'true'
+    ingress:
+      app:
+        annotations:
+          external-dns.alpha.kubernetes.io/target: internal.donoso.family
+        className: internal
+        hosts:
+        - host: zigbee.donoso.family
+          paths:
+          - path: /
+            service:
+              identifier: app
+              port: http
+    persistence:
+      config:
+        existingClaim: zigbee2mqtt
+      usb:
+        globalMounts:
+        - path: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
+        hostPath: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
+        hostPathType: CharDevice
+        type: hostPath
+    service:
+      app:
+        controller: zigbee2mqtt
+        ports:
+          http:
+            port: 80
+
--- kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt PersistentVolumeClaim: home/zigbee2mqtt

+++ kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt PersistentVolumeClaim: home/zigbee2mqtt

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

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

+++ kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt ExternalSecret: home/zigbee2mqtt-volsync

@@ -0,0 +1,29 @@

+---
+apiVersion: external-secrets.io/v1beta1
+kind: ExternalSecret
+metadata:
+  labels:
+    app.kubernetes.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zigbee2mqtt-volsync
+  namespace: home
+spec:
+  dataFrom:
+  - extract:
+      key: minio
+  - extract:
+      key: volsync-minio-template
+  secretStoreRef:
+    kind: ClusterSecretStore
+    name: onepassword-connect
+  target:
+    name: zigbee2mqtt-volsync-secret
+    template:
+      data:
+        AWS_ACCESS_KEY_ID: '{{ .MINIO_ROOT_USER }}'
+        AWS_SECRET_ACCESS_KEY: '{{ .MINIO_ROOT_PASSWORD }}'
+        RESTIC_PASSWORD: '{{ .RESTIC_PASSWORD }}'
+        RESTIC_REPOSITORY: '{{ .REPOSITORY_TEMPLATE }}/zigbee2mqtt'
+      engineVersion: v2
+
--- kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt ReplicationSource: home/zigbee2mqtt

+++ kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt ReplicationSource: home/zigbee2mqtt

@@ -0,0 +1,35 @@

+---
+apiVersion: volsync.backube/v1alpha1
+kind: ReplicationSource
+metadata:
+  labels:
+    app.kubernetes.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zigbee2mqtt
+  namespace: home
+spec:
+  restic:
+    accessModes:
+    - ReadWriteOnce
+    cacheAccessModes:
+    - ReadWriteOnce
+    cacheCapacity: 4Gi
+    cacheStorageClassName: longhorn-cache
+    copyMethod: Snapshot
+    moverSecurityContext:
+      fsGroup: 568
+      runAsGroup: 568
+      runAsUser: 568
+    pruneIntervalDays: 7
+    repository: zigbee2mqtt-volsync-secret
+    retain:
+      daily: 7
+      hourly: 24
+      weekly: 5
+    storageClassName: longhorn-snapshot
+    volumeSnapshotClassName: longhorn-snapclass
+  sourcePVC: zigbee2mqtt
+  trigger:
+    schedule: 0 * * * *
+
--- kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt ReplicationDestination: home/zigbee2mqtt-dst

+++ kubernetes/apps/home/zigbee2mqtt/app Kustomization: flux-system/zigbee2mqtt ReplicationDestination: home/zigbee2mqtt-dst

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

+---
+apiVersion: volsync.backube/v1alpha1
+kind: ReplicationDestination
+metadata:
+  labels:
+    app.kubernetes.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/name: zigbee2mqtt
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zigbee2mqtt-dst
+  namespace: home
+spec:
+  restic:
+    accessModes:
+    - ReadWriteOnce
+    cacheAccessModes:
+    - ReadWriteOnce
+    cacheCapacity: 8Gi
+    cacheStorageClassName: longhorn-cache
+    capacity: 1Gi
+    copyMethod: Snapshot
+    moverSecurityContext:
+      fsGroup: 568
+      runAsGroup: 568
+      runAsUser: 568
+    repository: zigbee2mqtt-volsync-secret
+    storageClassName: longhorn-snapshot
+    volumeSnapshotClassName: longhorn-snapclass
+  trigger:
+    manual: restore-once
+

@bot-x-mod
Copy link
Contributor

bot-x-mod bot commented Jun 24, 2024

--- HelmRelease: home/zigbee2mqtt Service: home/zigbee2mqtt

+++ HelmRelease: home/zigbee2mqtt Service: home/zigbee2mqtt

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

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

+++ HelmRelease: home/zigbee2mqtt Deployment: home/zigbee2mqtt

@@ -0,0 +1,139 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: zigbee2mqtt
+  labels:
+    app.kubernetes.io/component: zigbee2mqtt
+    app.kubernetes.io/instance: zigbee2mqtt
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: zigbee2mqtt
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: zigbee2mqtt
+      app.kubernetes.io/name: zigbee2mqtt
+      app.kubernetes.io/instance: zigbee2mqtt
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: zigbee2mqtt
+        app.kubernetes.io/instance: zigbee2mqtt
+        app.kubernetes.io/name: zigbee2mqtt
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      nodeSelector:
+        zzh.feature.node.kubernetes.io/zigbee: 'true'
+      containers:
+      - env:
+        - name: TZ
+          value: America/Santiago
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_DISCOVERY_TOPIC
+          value: homeassistant
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_LEGACY_ENTITY_ATTRIBUTES
+          value: 'false'
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_LEGACY_TRIGGERS
+          value: 'false'
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT_STATUS_TOPIC
+          value: homeassistant/status
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_LAST_SEEN
+          value: ISO_8601
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_LEGACY_API
+          value: 'false'
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_LEGACY_AVAILABILITY_PAYLOAD
+          value: 'false'
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_LOG_LEVEL
+          value: info
+        - name: ZIGBEE2MQTT_CONFIG_ADVANCED_LOG_OUTPUT
+          value: '["console"]'
+        - name: ZIGBEE2MQTT_CONFIG_AVAILABILITY_ACTIVE_TIMEOUT
+          value: '60'
+        - name: ZIGBEE2MQTT_CONFIG_AVAILABILITY_PASSIVE_TIMEOUT
+          value: '2000'
+        - name: ZIGBEE2MQTT_CONFIG_DEVICE_OPTIONS_LEGACY
+          value: 'false'
+        - name: ZIGBEE2MQTT_CONFIG_DEVICE_OPTIONS_RETAIN
+          value: 'true'
+        - name: ZIGBEE2MQTT_CONFIG_EXPERIMENTAL_NEW_API
+          value: 'true'
+        - name: ZIGBEE2MQTT_CONFIG_FRONTEND_PORT
+          value: '80'
+        - name: ZIGBEE2MQTT_CONFIG_FRONTEND_URL
+          value: https://zigbee.donoso.family
+        - name: ZIGBEE2MQTT_CONFIG_HOMEASSISTANT
+          value: 'true'
+        - name: ZIGBEE2MQTT_CONFIG_MQTT_INCLUDE_DEVICE_INFORMATION
+          value: 'true'
+        - name: ZIGBEE2MQTT_CONFIG_MQTT_KEEPALIVE
+          value: '60'
+        - name: ZIGBEE2MQTT_CONFIG_MQTT_REJECT_UNAUTHORIZED
+          value: 'true'
+        - name: ZIGBEE2MQTT_CONFIG_MQTT_SERVER
+          value: mqtt://emqx-listeners.database.svc.cluster.local:1883
+        - name: ZIGBEE2MQTT_CONFIG_MQTT_VERSION
+          value: '5'
+        - name: ZIGBEE2MQTT_CONFIG_PERMIT_JOIN
+          value: 'false'
+        - name: ZIGBEE2MQTT_CONFIG_SERIAL_PORT
+          value: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
+        - name: ZIGBEE2MQTT_DATA
+          value: /config
+        envFrom:
+        - secretRef:
+            name: zigbee2mqtt-secret
+        image: ghcr.io/koenkk/zigbee2mqtt:1.38.0@sha256:8a893949ab01ea25fe1189a02a24f7fee3d7e8717d0973bd3dd6989a3a45a6bf
+        livenessProbe:
+          failureThreshold: 3
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          tcpSocket:
+            port: 80
+          timeoutSeconds: 1
+        name: app
+        readinessProbe:
+          failureThreshold: 3
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          tcpSocket:
+            port: 80
+          timeoutSeconds: 1
+        resources:
+          limits:
+            memory: 512Mi
+          requests:
+            cpu: 10m
+        securityContext:
+          privileged: true
+        startupProbe:
+          failureThreshold: 30
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          tcpSocket:
+            port: 80
+          timeoutSeconds: 1
+        volumeMounts:
+        - mountPath: /config
+          name: config
+        - mountPath: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
+          name: usb
+      volumes:
+      - name: config
+        persistentVolumeClaim:
+          claimName: zigbee2mqtt
+      - hostPath:
+          path: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
+          type: CharDevice
+        name: usb
+
--- HelmRelease: home/zigbee2mqtt Ingress: home/zigbee2mqtt

+++ HelmRelease: home/zigbee2mqtt Ingress: home/zigbee2mqtt

@@ -0,0 +1,25 @@

+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: zigbee2mqtt
+  labels:
+    app.kubernetes.io/instance: zigbee2mqtt
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: zigbee2mqtt
+  annotations:
+    external-dns.alpha.kubernetes.io/target: internal.donoso.family
+spec:
+  ingressClassName: internal
+  rules:
+  - host: zigbee.donoso.family
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: zigbee2mqtt
+            port:
+              number: 80
+

@blackjid blackjid merged commit 000e368 into main Jun 24, 2024
4 of 5 checks passed
@blackjid blackjid deleted the migrate_zigbee branch June 24, 2024 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant