Skip to content

Commit

Permalink
[home] added frigate
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberdev committed Feb 13, 2024
1 parent e788b6f commit dc3ad0d
Show file tree
Hide file tree
Showing 11 changed files with 288 additions and 0 deletions.
41 changes: 41 additions & 0 deletions apps/argocd/base/home/frigate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: frigate
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: apps
source:
repoURL: "https://github.com/gruberdev/homelab.git"
path: apps/home/frigate
targetRevision: main
kustomize:
commonLabels:
app.kubernetes.io/category: home
destination:
namespace: homeassistant
name: in-cluster
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- Prune=true
- ServerSideApply=true
retry:
limit: 10
backoff:
duration: 20s
factor: 2
maxDuration: 15m
info:
- name: "Github Repository:"
value: >-
https://github.com/blakeblackshear/frigate
- name: "Official documentation:"
value: >-
https://docs.frigate.video/
- name: "Homelab documentation:"
value: >-
https://github.com/gruberdev/homelab/tree/main/apps/home/frigate
1 change: 1 addition & 0 deletions apps/argocd/base/home/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ resources:
- openwakeword.yaml
- piper.yaml
- whisper.yaml
- frigate.yaml
- wyze.yaml
- external-mic.yaml
- satellite.yaml
Expand Down
25 changes: 25 additions & 0 deletions apps/data/storage/base/home/frigate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: frigate-data
namespace: homeassistant
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 15Gi
storageClassName: mayastor-single-replica
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: frigate-media
namespace: homeassistant
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 80Gi
storageClassName: mayastor-single-replica
1 change: 1 addition & 0 deletions apps/data/storage/base/home/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resources:
- piper.yaml
- whisper.yaml
- wyze.yaml
- frigate.yaml

commonAnnotations:
argocd.argoproj.io/sync-options: Delete=false
1 change: 1 addition & 0 deletions apps/home/frigate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Frigate NVR
39 changes: 39 additions & 0 deletions apps/home/frigate/base/cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: frigate-config
data:
config.yml: |
go2rtc:
streams:
hall_cam: "ffmpeg:http://home-assistant.homeassistant.svc.cluster.local:8123/api/camera_proxy_stream/camera.acessoweb_scseg_com_br#video=h264#hardware#header='Authorization: Bearer {FRIGATE_HA_TOKEN}'#header='Content-Type: application/json'"
cameras:
hall_cam:
ffmpeg:
input_args: preset-rtsp-generic
inputs:
- path: rtsp://127.0.0.1:8554/hall_cam
roles:
- detect
- record
mqtt:
enabled: False
ffmpeg:
hwaccel_args: preset-nvidia-h264
detectors:
tensorrt:
type: tensorrt
device: 0
database:
path: /config/frigate.db
audio:
enabled: False
record:
enabled: True
retain:
days: 3
mode: all
events:
retain:
default: 30
mode: motion
97 changes: 97 additions & 0 deletions apps/home/frigate/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frigate
labels:
app: frigate
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: frigate
template:
metadata:
labels:
app: frigate
spec:
runtimeClassName: nvidia
containers:
- name: frigate
image: ghcr.io/blakeblackshear/frigate:master-77e7777-tensorrt
imagePullPolicy: Always
env:
- name: NVIDIA_VISIBLE_DEVICES
value: "all"
- name: NVIDIA_DRIVER_CAPABILITIES
value: "all"
envFrom:
- secretRef:
name: frigate-vars
optional: true
livenessProbe:
httpGet:
path: /
port: web
scheme: HTTP
initialDelaySeconds: 30
failureThreshold: 5
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /
port: web
scheme: HTTP
initialDelaySeconds: 15
failureThreshold: 5
timeoutSeconds: 10
ports:
- name: web
containerPort: 5000
protocol: TCP
- name: rtsp
containerPort: 8554
protocol: TCP
- name: webrtc-tcp
containerPort: 8555
protocol: TCP
- name: webrtc-udp
containerPort: 8555
protocol: UDP
resources:
requests:
cpu: 300m
memory: 512Mi
limits:
cpu: 800m
memory: 2Gi
volumeMounts:
- name: data
mountPath: /config
- name: configmap
mountPath: /config/config.yml
subPath: config.yml
- name: media
mountPath: /data
- name: cache
mountPath: /tmp/cache
- name: dshm
mountPath: /dev/shm
volumes:
- name: data
persistentVolumeClaim:
claimName: frigate-data
- name: media
persistentVolumeClaim:
claimName: frigate-media
- name: cache
persistentVolumeClaim:
claimName: frigate-cache
- name: dshm
emptyDir:
medium: Memory
sizeLimit: 1Gi
- name: configmap
configMap:
name: frigate-config
7 changes: 7 additions & 0 deletions apps/home/frigate/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- svc.yaml
- cm.yaml
- secret.yaml
8 changes: 8 additions & 0 deletions apps/home/frigate/base/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: frigate-vars
annotations:
avp.kubernetes.io/path: "kv/data/ha"
stringData:
FRIGATE_HA_TOKEN: <auth-token>
51 changes: 51 additions & 0 deletions apps/home/frigate/base/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
kind: Service
metadata:
name: frigate-web
labels:
app: frigate
spec:
selector:
app: frigate
ports:
- name: web
port: 80
targetPort: 5000
protocol: TCP
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: frigate-rtsp
labels:
app: frigate
spec:
selector:
app: frigate
ports:
- name: rtsp
port: 8554
targetPort: 8554
protocol: TCP
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: frigate-webrtc
labels:
app: frigate
spec:
selector:
app: frigate
ports:
- name: webrtc-tcp
port: 8555
targetPort: 8555
protocol: TCP
- name: webrtc-udp
port: 8555
targetPort: 8555
protocol: UDP
type: ClusterIP
17 changes: 17 additions & 0 deletions apps/home/frigate/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./base

namespace: homeassistant

patches:
- patch: |-
- op: add
path: "/spec/template/spec/nodeSelector"
value:
kubernetes.io/arch: amd64
kubernetes.io/hostname: node-one
target:
kind: Deployment
name: frigate

0 comments on commit dc3ad0d

Please sign in to comment.