diff --git a/cluster/apps/home-automation/frigate/config.yaml b/cluster/apps/home-automation/frigate/config.yaml new file mode 100644 index 000000000..cde4182ff --- /dev/null +++ b/cluster/apps/home-automation/frigate/config.yaml @@ -0,0 +1,78 @@ +--- +logger: + default: info + logs: + frigate.record: debug + +mqtt: + host: emqx + topic_prefix: frigate + user: "{MQTT_USER}" + password: "{MQTT_PASSWORD}" + +database: + path: /data/frigate.db + +detectors: + coral: + type: edgetpu + device: usb + +objects: + track: + - person + filters: + person: + min_area: 2500 + max_area: 100000 + threshold: 0.7 + +ffmpeg: + hwaccel_args: + - -hwaccel + - vaapi + - -hwaccel_device + - /dev/dri/renderD128 + - -hwaccel_output_format + - yuv420p + # Enable audio on recordings... + # might cause issues on recording playback + # output_args: + # record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac + +rtmp: + enabled: true + +# snapshots: +# enabled: true +# timestamp: false +# bounding_box: true +# retain: +# default: 7 + +# record: +# enabled: true +# retain: +# days: 2 +# mode: motion +# events: +# retain: +# default: 5 +# mode: active_objects + +cameras: + # -- + frigate_river: + ffmpeg: + inputs: + - path: rtsp://192.168.1.2:7447/GtBsJuujvMQwA42n + roles: + - detect + - path: rtsp://192.168.1.2:7447/b2K0uh13iekTbyA1 + roles: + - rtmp + - record + detect: + width: 1024 + height: 576 + fps: 10 diff --git a/cluster/apps/home-automation/frigate/helm-release.yaml b/cluster/apps/home-automation/frigate/helm-release.yaml index 4c4f14a6b..e5691594a 100644 --- a/cluster/apps/home-automation/frigate/helm-release.yaml +++ b/cluster/apps/home-automation/frigate/helm-release.yaml @@ -8,90 +8,61 @@ spec: interval: 5m chart: spec: - # renovate: registryUrl=https://k8s-at-home.com/charts/ - chart: frigate - version: 7.1.0 + chart: kah-common-chart + version: 1.1.1 sourceRef: kind: HelmRepository name: k8s-at-home-charts namespace: flux-system interval: 5m + install: + createNamespace: true values: + fullnameOverride: *app image: - repository: blakeblackshear/frigate - tag: 0.9.0-f110a26-amd64 - - securityContext: - privileged: true - - persistence: - data: - enabled: true - existingClaim: frigate-config - mountPath: /data - usb: - enabled: true - type: hostPath - hostPath: /dev/bus/usb - cache: - enabled: true - type: emptyDir - medium: Memory - sizeLimit: 2Gi - mountPath: /dev/shm - - config: | - mqtt: - host: emqx - topic_prefix: frigate - user: ${SECRET_MQTT_USERNAME} - password: ${SECRET_MQTT_PASSWORD} - - database: - path: /data/frigate.db - - detectors: - coral: - type: edgetpu - device: usb - - objects: - track: - - person - - dog - - cat - filters: - person: - min_area: 2500 - max_area: 100000 - threshold: 0.7 - dog: - min_area: 1000 - max_area: 10000 - threshold: 0.7 - cat: - min_area: 1000 - max_area: 10000 - threshold: 0.7 - - ffmpeg: - hwaccel_args: - - -hwaccel - - vaapi - - -hwaccel_device - - /dev/dri/renderD128 - - -hwaccel_output_format - - yuv420p - - podAnnotations: - configmap.reloader.stakater.com/reload: "frigate-config" - + repository: docker.io/blakeblackshear/frigate + tag: 0.10.1-amd64 + env: + TZ: "Europe/Paris" + MQTT_USER: "${SECRET_MQTT_USERNAME}" + MQTT_PASSWORD: ${SECRET_MQTT_PASSWORD} service: main: - annotations: - prometheus.io/probe: "true" - prometheus.io/protocol: http - + ports: + http: + port: &port 5000 + probes: + liveness: + enabled: true + custom: true + spec: + httpGet: + path: /api/version + port: *port + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + readiness: + enabled: true + custom: true + spec: + httpGet: + path: /api/version + port: *port + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + startup: + enabled: true + custom: true + spec: + httpGet: + path: /api/version + port: *port + failureThreshold: 30 + periodSeconds: 10 ingress: main: enabled: true @@ -99,18 +70,41 @@ spec: annotations: nginx.ingress.kubernetes.io/auth-url: "http://authelia.networking.svc.cluster.local/api/verify" nginx.ingress.kubernetes.io/auth-signin: "https://login.${SECRET_CLUSTER_DOMAIN}" - # traefik.ingress.kubernetes.io/router.entrypoints: "websecure" - # traefik.ingress.kubernetes.io/router.middlewares: networking-forward-auth@kubernetescrd hosts: - - host: "frigate.${SECRET_CLUSTER_DOMAIN}" + - host: &host "frigate.${SECRET_CLUSTER_DOMAIN}" paths: - path: / pathType: Prefix tls: - hosts: - - "frigate.${SECRET_CLUSTER_DOMAIN}" - secretName: "${SECRET_CLUSTER_CERTIFICATE_DEFAULT}" - + - *host + securityContext: + privileged: true + persistence: + config: + enabled: true + type: configMap + name: *app + subPath: config.yaml + mountPath: /config/config.yml + readOnly: true + data: + enabled: true + existingClaim: frigate-config + usb: + enabled: true + type: hostPath + hostPath: /dev/bus/usb + hostPathType: Directory + mountPath: /dev/bus/usb + cache: + enabled: true + type: emptyDir + medium: Memory + sizeLimit: 4Gi + mountPath: /dev/shm + podAnnotations: + configmap.reloader.stakater.com/reload: *app affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: @@ -120,16 +114,11 @@ spec: operator: In values: - "true" - - key: feature.node.kubernetes.io/custom-intel-gpu - operator: In - values: - - "true" - resources: requests: - gpu.intel.com/i915: 1 - memory: 100Mi cpu: 500m + memory: 1000Mi + gpu.intel.com/i915: "1" limits: - gpu.intel.com/i915: 1 - memory: 2000Mi + memory: 6000Mi + gpu.intel.com/i915: "1" diff --git a/cluster/apps/home-automation/frigate/kustomization.yaml b/cluster/apps/home-automation/frigate/kustomization.yaml index 21f1d9e05..2c82cc0e8 100644 --- a/cluster/apps/home-automation/frigate/kustomization.yaml +++ b/cluster/apps/home-automation/frigate/kustomization.yaml @@ -1,5 +1,14 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - helm-release.yaml - volume.yaml + - helm-release.yaml +namespace: home-automation +configMapGenerator: + - name: frigate + files: + - config.yaml +generatorOptions: + disableNameSuffixHash: true + annotations: + kustomize.toolkit.fluxcd.io/substitute: disabled diff --git a/cluster/apps/home-automation/kustomization.yaml b/cluster/apps/home-automation/kustomization.yaml index 14b2593ff..5f4a64280 100644 --- a/cluster/apps/home-automation/kustomization.yaml +++ b/cluster/apps/home-automation/kustomization.yaml @@ -3,7 +3,7 @@ kind: Kustomization resources: - namespace.yaml - emqx - - frigate + # - frigate - home-assistant - zigbee2mqtt - zwavejs2mqtt