From bd9f296d6ce951b3558ca8fda603444a32bdf62e Mon Sep 17 00:00:00 2001 From: BJWS Date: Thu, 6 Aug 2020 14:41:34 +0200 Subject: [PATCH] [frigate] Allow mask files to be passed to the container, version bump (#312) * Update Frigate version * Allow configmap that contains camera masks * Enable startupProbe functionality * Disable probes by default * Disable probes only during CI * Disable probes only during CI --- charts/frigate/Chart.yaml | 4 +-- charts/frigate/README.md | 3 +- charts/frigate/ci/ci-values.yaml | 8 +++++ charts/frigate/templates/deployment.yaml | 40 ++++++++++++++++++++++++ charts/frigate/values.yaml | 18 ++++++++++- 5 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 charts/frigate/ci/ci-values.yaml diff --git a/charts/frigate/Chart.yaml b/charts/frigate/Chart.yaml index 6e839d7a..af4c7bd1 100644 --- a/charts/frigate/Chart.yaml +++ b/charts/frigate/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 -appVersion: "0.5.1" +appVersion: "0.5.2" description: Realtime object detection on RTSP cameras with the Google Coral name: frigate -version: 3.1.0 +version: 3.2.0 keywords: - tensorflow - coral diff --git a/charts/frigate/README.md b/charts/frigate/README.md index abfe34c6..2f27f5e1 100644 --- a/charts/frigate/README.md +++ b/charts/frigate/README.md @@ -49,7 +49,7 @@ The command removes all the Kubernetes components associated with the chart and ## Configuration -The following tables lists the configurable parameters of the Sentry chart and their default values. +The following tables lists the configurable parameters of the Frigate chart and their default values. | Parameter | Description | Default | |----------------------------|-------------------------------------|---------------------------------------------------------| @@ -62,6 +62,7 @@ The following tables lists the configurable parameters of the Sentry chart and t | `extraSecretForEnvFrom` | Secrets containing env variables for | `[]` | | `coral.enabled` | Use the Coral USB device | `false` | | `coral.hostPath` | Host Path to reference USB device location (on the host) | `/dev/bus/usb` | +| `masksConfigMap` | Reference to existing ConfigMap that contains camera masks - [more info](https://github.com/blakeblackshear/frigate#masks-and-limiting-detection-to-a-certain-area) | `{}` | | `shmSize` | Shared memory size for processing | `1Gi` | | `config` | frigate configuration - see [config.yaml](https://github.com/blakeblackshear/frigate/blob/master/config/config.yml) for example | `{}` | | `Service.type` | Kubernetes service type for the frigate GUI | `ClusterIP` | diff --git a/charts/frigate/ci/ci-values.yaml b/charts/frigate/ci/ci-values.yaml new file mode 100644 index 00000000..5886303b --- /dev/null +++ b/charts/frigate/ci/ci-values.yaml @@ -0,0 +1,8 @@ +# Probes configuration +probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false diff --git a/charts/frigate/templates/deployment.yaml b/charts/frigate/templates/deployment.yaml index afa63a10..dd652a7b 100644 --- a/charts/frigate/templates/deployment.yaml +++ b/charts/frigate/templates/deployment.yaml @@ -29,6 +29,27 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} + initContainers: + - name: config + securityContext: + readOnlyRootFilesystem: true + image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}" + imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }} + volumeMounts: + - mountPath: /frigate-config + name: configmap + - mountPath: /masks + name: masks + - mountPath: /config + name: config + readOnly: false + command: ['sh', '-c'] + args: + - cp /frigate-config/* /config; + {{- if .Values.masksConfigMap }} + cp /masks/* /config; + {{- end }} + containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" @@ -59,6 +80,15 @@ spec: failureThreshold: {{ .Values.probes.readiness.failureThreshold }} timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} {{- end }} + {{- if .Values.probes.startup.enabled }} + startupProbe: + httpGet: + path: / + port: http + scheme: HTTP + failureThreshold: {{ .Values.probes.startup.failureThreshold }} + periodSeconds: {{ .Values.probes.startup.periodSeconds }} + {{- end }} env: {{- if .Values.timezone }} - name: TZ @@ -84,8 +114,18 @@ spec: {{- toYaml .Values.resources | nindent 12 }} volumes: - name: config + emptyDir: {} + - name: configmap configMap: name: {{ template "frigate.fullname" . }} + - name: masks + {{- if .Values.masksConfigMap }} + configMap: + name: {{ .Values.masksConfigMap }} + {{- else }} + emptyDir: + {} + {{- end }} {{- if .Values.coral.enabled }} - name: usb hostPath: diff --git a/charts/frigate/values.yaml b/charts/frigate/values.yaml index d5f35554..370faea9 100644 --- a/charts/frigate/values.yaml +++ b/charts/frigate/values.yaml @@ -9,7 +9,7 @@ strategyType: Recreate image: repository: blakeblackshear/frigate - tag: 0.5.1 + tag: 0.5.2 pullPolicy: IfNotPresent rtspPassword: password @@ -21,6 +21,18 @@ coral: enabled: false hostPath: /dev/bus/usb +# Specify image that generates the config folder containing the Frigate config file, masks (if specified), etc. +initContainer: + image: + repository: busybox + tag: latest + pullPolicy: Always + +# reference to configMap that contains the binary data of the masks to be copied into the container +# this requires that generateConfigFolder.enabled = true +# see https://github.com/blakeblackshear/frigate#masks-and-limiting-detection-to-a-certain-area for more info +masksConfigMap: {} + shmSize: 1Gi imagePullSecrets: [] @@ -179,6 +191,10 @@ probes: initialDelaySeconds: 30 failureThreshold: 5 timeoutSeconds: 10 + startup: + enabled: false + failureThreshold: 30 + periodSeconds: 10 service: type: ClusterIP