frigate - Allow selecting different image (eg tensorrt) (#1821)

This commit is contained in:
Stavros Kois
2023-12-03 21:58:17 +02:00
committed by GitHub
parent c7f1f7f598
commit e703ecbac3
6 changed files with 55 additions and 13 deletions

View File

@@ -3,7 +3,7 @@ description: Frigate is an NVR With Realtime Object Detection for IP Cameras
annotations:
title: Frigate
type: application
version: 1.1.3
version: 1.1.4
apiVersion: v2
appVersion: 0.12.1
kubeVersion: '>=1.16.0-0'

View File

@@ -25,6 +25,18 @@ questions:
schema:
type: dict
attrs:
- variable: imageSelector
label: Image
description: The image to use for Frigate.
schema:
type: string
default: "image"
required: true
enum:
- value: image
description: Frigate Image
- value: tensorrtImage
description: Frigate TensorRT Image
- variable: mountUSBBus
label: Mount USB Bus
description: |

View File

@@ -10,7 +10,7 @@ workload:
frigate:
enabled: true
primary: true
imageSelector: image
imageSelector: {{ .Values.frigateConfig.imageSelector | default "image" }}
securityContext:
runAsUser: 0
runAsGroup: 0

View File

@@ -1 +1 @@
{"filename": "values.yaml", "keys": ["image"]}
{"filename": "values.yaml", "keys": ["image","tensorrtImage"]}

View File

@@ -6,21 +6,45 @@ import sys
from catalog_update.upgrade_strategy import semantic_versioning
RE_STABLE_VERSION = re.compile(r'\d+\.\d+\.\d+')
RE_STABLE_VERSION_BASE = r'\d+\.\d+\.\d+'
ENUMS = {
'image': {
'RE_STABLE_VERSION': re.compile(RE_STABLE_VERSION_BASE),
'STRIP_TEXT': ''
},
'tensorrtImage': {
'RE_STABLE_VERSION': re.compile(rf'{RE_STABLE_VERSION_BASE}-tensorrt'),
'STRIP_TEXT': '-tensorrt'
},
}
def newer_mapping(image_tags):
key = list(image_tags.keys())[0]
tags = {t: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
version = semantic_versioning(list(tags))
if not version:
return {}
return {
'tags': {key: tags[version]},
'app_version': version,
output = {
"tags": {},
"app_version": ""
}
for key in image_tags.keys():
STRIP_TEXT = ENUMS[key].get('STRIP_TEXT', None) if key in ENUMS else None
RE_STABLE_VERSION = ENUMS[key].get('RE_STABLE_VERSION', None) if key in ENUMS else None
if (STRIP_TEXT is None) or (RE_STABLE_VERSION is None):
continue
tags = {t.strip(STRIP_TEXT): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
version = semantic_versioning(list(tags))
if not version:
continue
if key == 'image':
output['app_version'] = version
output['tags'][key] = tags[version]
return output
if __name__ == '__main__':
try:

View File

@@ -3,12 +3,18 @@ image:
pullPolicy: IfNotPresent
tag: 0.12.1
tensorrtImage:
repository: ghcr.io/blakeblackshear/frigate
pullPolicy: IfNotPresent
tag: 0.12.1-tensorrt
resources:
limits:
cpu: 4000m
memory: 8Gi
frigateConfig:
imageSelector: image
mountUSBBus: false
additionalEnvs: []