From 617f9d8aa806719aac7a24dec7ac35c205688be8 Mon Sep 17 00:00:00 2001 From: nautilus7 <1540233+nautilus7@users.noreply.github.com> Date: Thu, 1 Jun 2023 23:49:06 +0300 Subject: [PATCH] feat(frigate): port to new common (#9141) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Port Frigate to new common. This is a draft PR to for testing. Depending on the errors generated, I may or may not be able to fix them (I don't have any experience), so help might be needed from team members. ⚒️ Fixes # **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [x] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Kjeld Schouten Co-authored-by: StevenMcElligott <89483932+StevenMcElligott@users.noreply.github.com> --- charts/incubator/frigate/Chart.yaml | 5 +- charts/incubator/frigate/questions.yaml | 81 +++++------ charts/incubator/frigate/templates/NOTES.txt | 1 + .../frigate/templates/_configmap.tpl | 12 +- .../incubator/frigate/templates/common.yaml | 10 +- charts/incubator/frigate/values.yaml | 135 ++++++++---------- 6 files changed, 111 insertions(+), 133 deletions(-) create mode 100644 charts/incubator/frigate/templates/NOTES.txt diff --git a/charts/incubator/frigate/Chart.yaml b/charts/incubator/frigate/Chart.yaml index a407a1a7074..6a5e20c16d3 100644 --- a/charts/incubator/frigate/Chart.yaml +++ b/charts/incubator/frigate/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "0.11.1" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 + version: 12.10.2 deprecated: false description: NVR With Realtime Object Detection for IP Cameras home: https://truecharts.org/charts/incubator/frigate @@ -23,9 +23,8 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/frigate - https://github.com/blakeblackshear/frigate type: application -version: 6.0.2 +version: 7.0.0 annotations: truecharts.org/catagories: | - nvr truecharts.org/SCALE-support: "true" - truecharts.org/grade: U diff --git a/charts/incubator/frigate/questions.yaml b/charts/incubator/frigate/questions.yaml index 3743118bda5..547fd81ff82 100644 --- a/charts/incubator/frigate/questions.yaml +++ b/charts/incubator/frigate/questions.yaml @@ -291,7 +291,7 @@ questions: type: int min: 1 max: 31 - default: 8 + "null": true - variable: mode label: Mode description: | @@ -596,7 +596,7 @@ questions: type: int min: 1 max: 255 - default: 25 + "null": true - variable: contour_area label: Contour Area description: | @@ -619,7 +619,7 @@ questions: schema: type: string default: "" - valid_chars: '^[0-9]+(\.[0-9]*)?$' + valid_chars: '^$|^[0-9]+(\.[0-9]*)?$' - variable: frame_alpha label: Frame Alpha description: | @@ -630,7 +630,7 @@ questions: schema: type: string default: "" - valid_chars: '^[0-9]+(\.[0-9]*)?$' + valid_chars: '^$|^[0-9]+(\.[0-9]*)?$' - variable: frame_height label: Frame Height description: | @@ -1436,33 +1436,28 @@ questions: type: boolean default: true # Include{containerConfig} +# Include{podOptions} # Include{serviceRoot} - - variable: main - label: Main Service - description: The Primary service on which the healthcheck runs, often the webUI - schema: - additional_attrs: true - type: dict - attrs: +# Include{serviceMain} # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: main - label: Main Service Port Configuration + label: "Main Service Port Configuration" schema: additional_attrs: true type: dict attrs: - variable: port - label: Port - description: This port exposes the container port on the service + label: "Port" + description: "This port exposes the container port on the service" schema: type: int default: 10500 editable: true required: true - variable: rtmp - label: RTMP Service - description: The service on which nodes connect to. + label: "RTMP Service" + description: "The service on which nodes connect to." schema: additional_attrs: true type: dict @@ -1470,14 +1465,14 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: rtmp - label: RTMP Service Port Configuration + label: "RTMP Service Port Configuration" schema: additional_attrs: true type: dict attrs: - variable: port - label: Port - description: This port exposes the container port on the service + label: "Port" + description: "This port exposes the container port on the service" schema: type: int default: 1935 @@ -1488,16 +1483,16 @@ questions: # Include{serviceList} # Include{persistenceRoot} - variable: media - label: App Media - description: Stores the Application Media + label: "App Media" + description: "Stores the Application Media" schema: additional_attrs: true type: dict attrs: # Include{persistenceBasic} - variable: db - label: App DB - description: Stores the Application DB + label: "App DB" + description: "Stores the Application DB" schema: additional_attrs: true type: dict @@ -1506,7 +1501,7 @@ questions: # Include{persistenceList} # Include{ingressRoot} - variable: main - label: Main Ingress + label: "Main Ingress" schema: additional_attrs: true type: dict @@ -1517,28 +1512,28 @@ questions: # Include{ingressAdvanced} # Include{ingressList} -# Include{podSecurityContextRoot} - - variable: runAsUser - label: runAsUser - description: The UserID of the user running the application - schema: - type: int - default: 0 - - variable: runAsGroup - label: runAsGroup - description: The groupID this App of the user running the application - schema: - type: int - default: 0 +# Include{securityContextRoot} + - variable: runAsUser + label: "runAsUser" + description: "The UserID of the user running the application" + schema: + type: int + default: 0 + - variable: runAsGroup + label: "runAsGroup" + description: "The groupID this App of the user running the application" + schema: + type: int + default: 0 # Include{securityContextContainer} # Include{securityContextAdvanced} # Include{securityContextPod} - - variable: fsGroup - label: fsGroup - description: The group that should own ALL storage. - schema: - type: int - default: 568 + - variable: fsGroup + label: "fsGroup" + description: "The group that should own ALL storage." + schema: + type: int + default: 568 # Include{resources} # Include{advanced} diff --git a/charts/incubator/frigate/templates/NOTES.txt b/charts/incubator/frigate/templates/NOTES.txt new file mode 100644 index 00000000000..72e715a3bc5 --- /dev/null +++ b/charts/incubator/frigate/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/frigate/templates/_configmap.tpl b/charts/incubator/frigate/templates/_configmap.tpl index f3648780fdd..51b56bb2d4b 100644 --- a/charts/incubator/frigate/templates/_configmap.tpl +++ b/charts/incubator/frigate/templates/_configmap.tpl @@ -1,16 +1,6 @@ {{/* Define the configmap */}} {{- define "frigate.configmap" -}} - -{{- $configName := printf "%s-frigate-config" (include "tc.common.names.fullname" .) }} - ---- - -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ $configName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} +enabled: true data: config.yml: | database: diff --git a/charts/incubator/frigate/templates/common.yaml b/charts/incubator/frigate/templates/common.yaml index 1f8971b2d42..d1ee5e989de 100644 --- a/charts/incubator/frigate/templates/common.yaml +++ b/charts/incubator/frigate/templates/common.yaml @@ -1,7 +1,11 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . }} -{{- include "frigate.configmap" . -}} +{{/* Render configmap for frigate */}} +{{- $config := include "frigate.configmap" . | fromYaml -}} +{{- if $config -}} + {{- $_ := set .Values.configmap "frigate-config" $config -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/frigate/values.yaml b/charts/incubator/frigate/values.yaml index a93a3a1844b..8a2b77f3507 100644 --- a/charts/incubator/frigate/values.yaml +++ b/charts/incubator/frigate/values.yaml @@ -4,13 +4,11 @@ image: tag: 0.11.1@sha256:8dd7273eebf396563d7bbc14778fd3d58c624e5063ffcf74b5b0afe63e7cdd7f securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false - -podSecurityContext: - runAsUser: 0 - runAsGroup: 0 - + container: + readOnlyRootFilesystem: false + runAsNonRoot: false + runAsUser: 0 + runAsGroup: 0 # -- The "render_config" key is only used internally to "render" or not the configuration # - Some parts of the config bellow are slightly modified so they can be added on SCALE UI. Mainly lists. # - Do not blindly copy paste configuration from upstream. As this won't work on all cases @@ -31,16 +29,15 @@ frigate: detectors: # -- Enable it to add the configuration in the config file render_config: false - config: - [] - # -- Required: Name of the detector - # - name: coral - # # -- Valid values are 'edgetpu' (requires device property below) and 'cpu'. - # type: edgetpu - # # -- Device name as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api - # device: usb - # # -- This value is only used for CPU types - # num_threads: 3 + config: [] + # -- Required: Name of the detector + # - name: coral + # # -- Valid values are 'edgetpu' (requires device property below) and 'cpu'. + # type: edgetpu + # # -- Device name as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api + # device: usb + # # -- This value is only used for CPU types + # num_threads: 3 model: # -- Enable it to add the configuration in the config file @@ -54,12 +51,11 @@ frigate: # -- Optional: Path to the labelmap labelmap_path: "" # -- Optional: Label name modifications. - labelmap: - [] - # - model: "2" - # name: vehicle - # - model: 3 - # name: vehicle + labelmap: [] + # - model: "2" + # name: vehicle + # - model: 3 + # name: vehicle logger: # -- Enable it to add the configuration in the config file @@ -67,10 +63,9 @@ frigate: # -- Optional: Default log verbosity (default: shown below) default: info # -- Optional: Component specific logger overrides - logs: - [] - # - component: frigate.event - # verbosity: debug + logs: [] + # - component: frigate.event + # verbosity: debug birdseye: # -- Enable it to add the configuration in the config file @@ -151,33 +146,31 @@ frigate: # -- Enable it to add the configuration in the config file render_config: false # -- Optional: list of objects to track from labelmap.txt - track: - [] - # - person - # - car + track: [] + # - person + # - car # -- Optional: mask to prevent all object types from being detected in certain areas (default: no mask) # - Checks based on the bottom center of the bounding box of the object. # - NOTE: This mask is COMBINED with the object type specific mask below mask: "" # - Optional: filters to reduce false positives for specific object types - filters: - [] - # - object: person - # # -- Optional: Minimum width*height of the bounding box for the detected object - # min_area: 5000 - # # -- Optional: Maximum width*height of the bounding box for the detected object - # max_area: 100000 - # # -- Optional: Minimum width/height of the bounding box for the detected object - # min_ratio: "0.5" - # # -- Optional: Maximum width/height of the bounding box for the detected object - # max_ratio: "2.0" - # # -- Optional: Minimum score for the object to initiate tracking - # min_score: "0.5" - # # -- Optional: Minimum decimal percentage for tracked object's computed score to be considered a true positive - # threshold: "0.7" - # # -- Optional: Mask to prevent this object type from being detected in certain areas - # # - Checks based on the bottom center of the bounding box of the object - # mask: 0,0,1000,0,1000,200,0,200 + filters: [] + # - object: person + # # -- Optional: Minimum width*height of the bounding box for the detected object + # min_area: 5000 + # # -- Optional: Maximum width*height of the bounding box for the detected object + # max_area: 100000 + # # -- Optional: Minimum width/height of the bounding box for the detected object + # min_ratio: "0.5" + # # -- Optional: Maximum width/height of the bounding box for the detected object + # max_ratio: "2.0" + # # -- Optional: Minimum score for the object to initiate tracking + # min_score: "0.5" + # # -- Optional: Minimum decimal percentage for tracked object's computed score to be considered a true positive + # threshold: "0.7" + # # -- Optional: Mask to prevent this object type from being detected in certain areas + # # - Checks based on the bottom center of the bounding box of the object + # mask: 0,0,1000,0,1000,200,0,200 motion: # -- Enable it to add the configuration in the config file @@ -254,9 +247,8 @@ frigate: # -- Optional: Number of seconds after the event to include post_capture: null # -- Optional: Objects to save recordings for. Defaults to all - objects: - [] - # - person + objects: [] + # - person # -- Optional: Restrict recordings to objects that entered any of the listed zones required_zones: [] # -- Optional: Retention settings for recordings of events @@ -271,10 +263,9 @@ frigate: # - active_objects - save all recording segments for event with active/moving objects mode: "" # -- Optional: Per object retention days - objects: - [] - # - object: person - # days: 15 + objects: [] + # - object: person + # days: 15 snapshots: # -- Enable it to add the configuration in the config file @@ -301,10 +292,9 @@ frigate: # -- Required: Default retention days (default: shown below) default: 10 # -- Optional: Per object retention days - objects: - [] - # - object: person - # days: 15 + objects: [] + # - object: person + # days: 15 rtmp: # -- Enable it to add the configuration in the config file @@ -398,17 +388,15 @@ frigate: # - NOTE: Presence in a zone is evaluated only based on the bottom center of the objects bounding box. coordinates: 545,1077,747,939,788,805 # -- Optional: List of objects that can trigger this zone (default: all tracked objects) - objects: - [] - # - person + objects: [] + # - person # -- Optional: Zone level object filters. # -NOTE: The global and camera filters are applied upstream. - filters: - [] - # - object: person - # min_area: null - # max_area: null - # threshold: "" + filters: [] + # - object: person + # min_area: null + # max_area: null + # threshold: "" # -- Optional: Configuration for the jpg snapshots published via MQTT mqtt: # -- Enable it to add the configuration in the config file @@ -448,7 +436,7 @@ service: ports: main: port: 10500 - protocol: HTTP + protocol: http targetPort: 5000 rtmp: enabled: true @@ -480,11 +468,12 @@ persistence: frigate-config: enabled: true mountPath: /config - type: configMap - objectName: '{{ template "tc.common.names.fullname" . }}-frigate-config' + type: configmap + objectName: frigate-config items: - key: config.yml path: config.yml portal: - enabled: true + open: + enabled: true