From 1ea448da6e154da7bec18fa43a0ff41c5af2995c Mon Sep 17 00:00:00 2001 From: sonicaj Date: Thu, 21 Dec 2023 08:36:42 +0000 Subject: [PATCH] Publish new changes in catalog --- community/frigate/{1.1.7 => 1.2.0}/Chart.lock | 0 community/frigate/{1.1.7 => 1.2.0}/Chart.yaml | 2 +- community/frigate/{1.1.7 => 1.2.0}/README.md | 0 .../frigate/{1.1.7 => 1.2.0}/app-readme.md | 0 .../{1.1.7 => 1.2.0}/charts/common-1.2.5.tgz | Bin .../{1.1.7 => 1.2.0}/ci/basic-values.yaml | 6 +- .../{1.1.7 => 1.2.0}/ci/extra-values.yaml | 12 +- .../{1.1.7 => 1.2.0}/ci/hostNet-values.yaml | 6 +- .../frigate/{1.1.7 => 1.2.0}/ix_values.yaml | 6 +- .../frigate/{1.1.7 => 1.2.0}/metadata.yaml | 0 community/frigate/1.2.0/migrations/migrate | 73 +++++ .../frigate/{1.1.7 => 1.2.0}/questions.yaml | 280 +++++++++++++----- .../{1.1.7 => 1.2.0}/templates/NOTES.txt | 0 .../{1.1.7 => 1.2.0}/templates/_frigate.tpl | 0 .../templates/_persistence.tpl | 41 ++- .../{1.1.7 => 1.2.0}/templates/_portal.tpl | 0 .../{1.1.7 => 1.2.0}/templates/_service.tpl | 0 .../{1.1.7 => 1.2.0}/templates/common.yaml | 0 18 files changed, 307 insertions(+), 119 deletions(-) rename community/frigate/{1.1.7 => 1.2.0}/Chart.lock (100%) rename community/frigate/{1.1.7 => 1.2.0}/Chart.yaml (97%) rename community/frigate/{1.1.7 => 1.2.0}/README.md (100%) rename community/frigate/{1.1.7 => 1.2.0}/app-readme.md (100%) rename community/frigate/{1.1.7 => 1.2.0}/charts/common-1.2.5.tgz (100%) rename community/frigate/{1.1.7 => 1.2.0}/ci/basic-values.yaml (62%) rename community/frigate/{1.1.7 => 1.2.0}/ci/extra-values.yaml (54%) rename community/frigate/{1.1.7 => 1.2.0}/ci/hostNet-values.yaml (56%) rename community/frigate/{1.1.7 => 1.2.0}/ix_values.yaml (88%) rename community/frigate/{1.1.7 => 1.2.0}/metadata.yaml (100%) create mode 100755 community/frigate/1.2.0/migrations/migrate rename community/frigate/{1.1.7 => 1.2.0}/questions.yaml (60%) rename community/frigate/{1.1.7 => 1.2.0}/templates/NOTES.txt (100%) rename community/frigate/{1.1.7 => 1.2.0}/templates/_frigate.tpl (100%) rename community/frigate/{1.1.7 => 1.2.0}/templates/_persistence.tpl (55%) rename community/frigate/{1.1.7 => 1.2.0}/templates/_portal.tpl (100%) rename community/frigate/{1.1.7 => 1.2.0}/templates/_service.tpl (100%) rename community/frigate/{1.1.7 => 1.2.0}/templates/common.yaml (100%) diff --git a/community/frigate/1.1.7/Chart.lock b/community/frigate/1.2.0/Chart.lock similarity index 100% rename from community/frigate/1.1.7/Chart.lock rename to community/frigate/1.2.0/Chart.lock diff --git a/community/frigate/1.1.7/Chart.yaml b/community/frigate/1.2.0/Chart.yaml similarity index 97% rename from community/frigate/1.1.7/Chart.yaml rename to community/frigate/1.2.0/Chart.yaml index d046657ebe..709b66c8c7 100644 --- a/community/frigate/1.1.7/Chart.yaml +++ b/community/frigate/1.2.0/Chart.yaml @@ -3,7 +3,7 @@ description: Frigate is an NVR With Realtime Object Detection for IP Cameras annotations: title: Frigate type: application -version: 1.1.7 +version: 1.2.0 apiVersion: v2 appVersion: 0.12.1 kubeVersion: '>=1.16.0-0' diff --git a/community/frigate/1.1.7/README.md b/community/frigate/1.2.0/README.md similarity index 100% rename from community/frigate/1.1.7/README.md rename to community/frigate/1.2.0/README.md diff --git a/community/frigate/1.1.7/app-readme.md b/community/frigate/1.2.0/app-readme.md similarity index 100% rename from community/frigate/1.1.7/app-readme.md rename to community/frigate/1.2.0/app-readme.md diff --git a/community/frigate/1.1.7/charts/common-1.2.5.tgz b/community/frigate/1.2.0/charts/common-1.2.5.tgz similarity index 100% rename from community/frigate/1.1.7/charts/common-1.2.5.tgz rename to community/frigate/1.2.0/charts/common-1.2.5.tgz diff --git a/community/frigate/1.1.7/ci/basic-values.yaml b/community/frigate/1.2.0/ci/basic-values.yaml similarity index 62% rename from community/frigate/1.1.7/ci/basic-values.yaml rename to community/frigate/1.2.0/ci/basic-values.yaml index bc5dc10467..a1f2756e5c 100644 --- a/community/frigate/1.1.7/ci/basic-values.yaml +++ b/community/frigate/1.2.0/ci/basic-values.yaml @@ -9,11 +9,9 @@ frigateNetwork: frigateStorage: config: - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/config + type: pvc media: - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/media + type: pvc cache: sizeGiB: 2 shm: diff --git a/community/frigate/1.1.7/ci/extra-values.yaml b/community/frigate/1.2.0/ci/extra-values.yaml similarity index 54% rename from community/frigate/1.1.7/ci/extra-values.yaml rename to community/frigate/1.2.0/ci/extra-values.yaml index 60fd5c5447..51a7537cdd 100644 --- a/community/frigate/1.1.7/ci/extra-values.yaml +++ b/community/frigate/1.2.0/ci/extra-values.yaml @@ -12,19 +12,15 @@ frigateConfig: frigateStorage: config: - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/config + type: pvc media: - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/media + type: pvc cache: sizeGiB: 2 shm: sizeMiB: 128 additionalStorages: - - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/clips + - type: pvc mountPath: /clips - - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/snapshots + - type: pvc mountPath: /snapshots diff --git a/community/frigate/1.1.7/ci/hostNet-values.yaml b/community/frigate/1.2.0/ci/hostNet-values.yaml similarity index 56% rename from community/frigate/1.1.7/ci/hostNet-values.yaml rename to community/frigate/1.2.0/ci/hostNet-values.yaml index 4b7768b243..d36cd4328a 100644 --- a/community/frigate/1.1.7/ci/hostNet-values.yaml +++ b/community/frigate/1.2.0/ci/hostNet-values.yaml @@ -6,11 +6,9 @@ frigateNetwork: frigateStorage: config: - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/config + type: pvc media: - type: hostPath - hostPath: /mnt/{{ .Release.Namespace }}/media + type: pvc cache: sizeGiB: 2 shm: diff --git a/community/frigate/1.1.7/ix_values.yaml b/community/frigate/1.2.0/ix_values.yaml similarity index 88% rename from community/frigate/1.1.7/ix_values.yaml rename to community/frigate/1.2.0/ix_values.yaml index d3960dcd38..8df21d4996 100644 --- a/community/frigate/1.1.7/ix_values.yaml +++ b/community/frigate/1.2.0/ix_values.yaml @@ -34,10 +34,12 @@ frigateGPU: {} frigateStorage: media: type: ixVolume - datasetName: media + ixVolumeConfig: + datasetName: media config: type: ixVolume - datasetName: config + ixVolumeConfig: + datasetName: config cache: sizeGiB: 1 shm: diff --git a/community/frigate/1.1.7/metadata.yaml b/community/frigate/1.2.0/metadata.yaml similarity index 100% rename from community/frigate/1.1.7/metadata.yaml rename to community/frigate/1.2.0/metadata.yaml diff --git a/community/frigate/1.2.0/migrations/migrate b/community/frigate/1.2.0/migrations/migrate new file mode 100755 index 0000000000..9f880bd21b --- /dev/null +++ b/community/frigate/1.2.0/migrations/migrate @@ -0,0 +1,73 @@ +#!/usr/bin/python3 +import json +import os +import sys + + +def storage_migrate(storage): + delete_keys = [] + if storage['type'] == 'hostPath': + # Check if the key exists, if not we have already migrated + if not storage.get('hostPath'): + return storage + + storage['hostPathConfig'] = {'hostPath': storage['hostPath']} + delete_keys.append('hostPath') + + elif storage['type'] == 'ixVolume': + # Check if the key exists, if not we have already migrated + if not storage.get('datasetName'): + return storage + + storage['ixVolumeConfig'] = {'datasetName': storage['datasetName']} + delete_keys.append('datasetName') + + elif storage['type'] == 'smb-pv-pvc': + # Check if the key exists, if not we have already migrated + if not storage.get('server'): + return storage + + storage['smbConfig'] = { + 'server': storage['server'], + 'share': storage['share'], + 'domain': storage['domain'], + 'username': storage['username'], + 'password': storage['password'], + 'size': storage['size'], + } + delete_keys.extend(['server', 'share', 'domain', 'username', 'password', 'size']) + + for key in delete_keys: + storage.pop(key, None) + + return storage + + +def migrate(values): + storage_key = 'frigateStorage' + storages = ['config', 'media'] + + for storage in storages: + check_val = values.get(storage_key, {}).get(storage, {}) + if not isinstance(check_val, dict) or not check_val: + raise Exception(f'Storage section {storage} is malformed') + + values[storage_key][storage] = storage_migrate(check_val) + + additionalStorages = values.get(storage_key, {}).get('additionalStorages', []) + for idx, storage in enumerate(additionalStorages): + if not isinstance(storage, dict) or not storage: + raise Exception(f'Item {idx} in additionalStorages is malformed') + + values[storage_key]['additionalStorages'][idx] = storage_migrate(storage) + + return values + + +if __name__ == '__main__': + if len(sys.argv) != 2: + exit(1) + + if os.path.exists(sys.argv[1]): + with open(sys.argv[1], 'r') as f: + print(json.dumps(migrate(json.loads(f.read())))) diff --git a/community/frigate/1.1.7/questions.yaml b/community/frigate/1.2.0/questions.yaml similarity index 60% rename from community/frigate/1.1.7/questions.yaml rename to community/frigate/1.2.0/questions.yaml index 1577218278..4c0b06b3bb 100644 --- a/community/frigate/1.1.7/questions.yaml +++ b/community/frigate/1.2.0/questions.yaml @@ -178,23 +178,64 @@ questions: description: Host Path (Path that already exists on the system) - value: "ixVolume" description: ixVolume (Dataset created automatically by the system) - - variable: datasetName - label: Dataset Name + - variable: ixVolumeConfig + label: ixVolume Configuration + description: The configuration for the ixVolume dataset. schema: - type: string + type: dict show_if: [["type", "=", "ixVolume"]] - required: true - hidden: true - immutable: true - default: "config" $ref: - "normalize/ixVolume" - - variable: hostPath - label: Host Path + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + required: true + immutable: true + hidden: true + default: "config" + - variable: aclEntries + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + - variable: hostPathConfig + label: Host Path Configuration schema: - type: hostpath + type: dict show_if: [["type", "=", "hostPath"]] - required: true + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: acl + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + $ref: + - "normalize/acl" + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["aclEnable", "=", false]] + required: true + - variable: media label: Frigate Media Storage description: The path to store Frigate Media. @@ -216,23 +257,64 @@ questions: description: Host Path (Path that already exists on the system) - value: "ixVolume" description: ixVolume (Dataset created automatically by the system) - - variable: datasetName - label: Dataset Name + - variable: ixVolumeConfig + label: ixVolume Configuration + description: The configuration for the ixVolume dataset. schema: - type: string + type: dict show_if: [["type", "=", "ixVolume"]] - required: true - hidden: true - immutable: true - default: "config" $ref: - "normalize/ixVolume" - - variable: hostPath - label: Host Path + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + required: true + immutable: true + hidden: true + default: "media" + - variable: aclEntries + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + - variable: hostPathConfig + label: Host Path Configuration schema: - type: hostpath + type: dict show_if: [["type", "=", "hostPath"]] - required: true + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: acl + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + $ref: + - "normalize/acl" + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["aclEnable", "=", false]] + required: true + - variable: cache label: Frigate Cache Storage schema: @@ -261,6 +343,7 @@ questions: max: 2048 default: 64 required: true + - variable: additionalStorages label: Additional Storage description: Additional storage for Frigate. @@ -291,74 +374,119 @@ questions: description: ixVolume (Dataset created automatically by the system) - value: "smb-pv-pvc" description: SMB Share (Mounts a persistent volume claim to a SMB share) + - variable: readOnly + label: Read Only + description: Mount the volume as read only. + schema: + type: boolean + default: false - variable: mountPath label: Mount Path description: The path inside the container to mount the storage. schema: type: path required: true - - variable: hostPath - label: Host Path - description: The host path to use for storage. + - variable: hostPathConfig + label: Host Path Configuration schema: - type: hostpath + type: dict show_if: [["type", "=", "hostPath"]] - required: true - - variable: datasetName - label: Dataset Name - description: The name of the dataset to use for storage. + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: acl + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + $ref: + - "normalize/acl" + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["aclEnable", "=", false]] + required: true + - variable: ixVolumeConfig + label: ixVolume Configuration + description: The configuration for the ixVolume dataset. schema: - type: string + type: dict show_if: [["type", "=", "ixVolume"]] - required: true - immutable: true - default: "storage_entry" $ref: - "normalize/ixVolume" - - variable: server - label: Server - description: The server for the SMB share. + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + required: true + immutable: true + default: "storage_entry" + - variable: aclEntries + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + - variable: smbConfig + label: SMB Share Configuration + description: The configuration for the SMB Share. schema: - type: string + type: dict show_if: [["type", "=", "smb-pv-pvc"]] - required: true - - variable: share - label: Share - description: The share name for the SMB share. - schema: - type: string - show_if: [["type", "=", "smb-pv-pvc"]] - required: true - - variable: domain - label: Domain (Optional) - description: The domain for the SMB share. - schema: - type: string - show_if: [["type", "=", "smb-pv-pvc"]] - - variable: username - label: Username - description: The username for the SMB share. - schema: - type: string - show_if: [["type", "=", "smb-pv-pvc"]] - required: true - - variable: password - label: Password - description: The password for the SMB share. - schema: - type: string - show_if: [["type", "=", "smb-pv-pvc"]] - required: true - private: true - - variable: size - label: Size (in Gi) - description: The size of the volume quota. - schema: - type: int - show_if: [["type", "=", "smb-pv-pvc"]] - required: true - min: 1 - default: 1 + attrs: + - variable: server + label: Server + description: The server for the SMB share. + schema: + type: string + required: true + - variable: share + label: Share + description: The share name for the SMB share. + schema: + type: string + required: true + - variable: domain + label: Domain (Optional) + description: The domain for the SMB share. + schema: + type: string + - variable: username + label: Username + description: The username for the SMB share. + schema: + type: string + required: true + - variable: password + label: Password + description: The password for the SMB share. + schema: + type: string + required: true + private: true + - variable: size + label: Size (in Gi) + description: The size of the volume quota. + schema: + type: int + required: true + min: 1 + default: 1 - variable: resources group: Resources Configuration diff --git a/community/frigate/1.1.7/templates/NOTES.txt b/community/frigate/1.2.0/templates/NOTES.txt similarity index 100% rename from community/frigate/1.1.7/templates/NOTES.txt rename to community/frigate/1.2.0/templates/NOTES.txt diff --git a/community/frigate/1.1.7/templates/_frigate.tpl b/community/frigate/1.2.0/templates/_frigate.tpl similarity index 100% rename from community/frigate/1.1.7/templates/_frigate.tpl rename to community/frigate/1.2.0/templates/_frigate.tpl diff --git a/community/frigate/1.1.7/templates/_persistence.tpl b/community/frigate/1.2.0/templates/_persistence.tpl similarity index 55% rename from community/frigate/1.1.7/templates/_persistence.tpl rename to community/frigate/1.2.0/templates/_persistence.tpl index 7000ab8b29..82ab2f97a4 100644 --- a/community/frigate/1.1.7/templates/_persistence.tpl +++ b/community/frigate/1.2.0/templates/_persistence.tpl @@ -2,9 +2,8 @@ persistence: config: enabled: true - type: {{ .Values.frigateStorage.config.type }} - datasetName: {{ .Values.frigateStorage.config.datasetName | default "" }} - hostPath: {{ .Values.frigateStorage.config.hostPath | default "" }} + {{- include "frigate.storage.ci.migration" (dict "storage" .Values.frigateStorage.config) }} + {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.frigateStorage.config) | nindent 4 }} targetSelector: frigate: frigate: @@ -13,9 +12,8 @@ persistence: mountPath: /config media: enabled: true - type: {{ .Values.frigateStorage.media.type }} - datasetName: {{ .Values.frigateStorage.media.datasetName | default "" }} - hostPath: {{ .Values.frigateStorage.media.hostPath | default "" }} + {{- include "frigate.storage.ci.migration" (dict "storage" .Values.frigateStorage.media) }} + {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.frigateStorage.media) | nindent 4 }} targetSelector: frigate: frigate: @@ -56,28 +54,23 @@ persistence: mountPath: /dev/bus/usb {{- end -}} {{- range $idx, $storage := .Values.frigateStorage.additionalStorages }} - {{ printf "frigate-%v" (int $idx) }}: - {{- $size := "" -}} - {{- if $storage.size -}} - {{- $size = (printf "%vGi" $storage.size) -}} - {{- end }} + {{ printf "frigate-%v:" (int $idx) }} enabled: true - type: {{ $storage.type }} - datasetName: {{ $storage.datasetName | default "" }} - hostPath: {{ $storage.hostPath | default "" }} - server: {{ $storage.server | default "" }} - share: {{ $storage.share | default "" }} - domain: {{ $storage.domain | default "" }} - username: {{ $storage.username | default "" }} - password: {{ $storage.password | default "" }} - size: {{ $size }} - {{- if eq $storage.type "smb-pv-pvc" }} - mountOptions: - - key: noperm - {{- end }} + {{- include "frigate.storage.ci.migration" (dict "storage" $storage) }} + {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }} targetSelector: frigate: frigate: mountPath: {{ $storage.mountPath }} {{- end }} {{- end -}} + +{{/* TODO: Remove on the next version bump, eg 1.2.0+ */}} +{{- define "frigate.storage.ci.migration" -}} + {{- $storage := .storage -}} + + {{- if $storage.hostPath -}} + {{- $_ := set $storage "hostPathConfig" dict -}} + {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}} + {{- end -}} +{{- end -}} diff --git a/community/frigate/1.1.7/templates/_portal.tpl b/community/frigate/1.2.0/templates/_portal.tpl similarity index 100% rename from community/frigate/1.1.7/templates/_portal.tpl rename to community/frigate/1.2.0/templates/_portal.tpl diff --git a/community/frigate/1.1.7/templates/_service.tpl b/community/frigate/1.2.0/templates/_service.tpl similarity index 100% rename from community/frigate/1.1.7/templates/_service.tpl rename to community/frigate/1.2.0/templates/_service.tpl diff --git a/community/frigate/1.1.7/templates/common.yaml b/community/frigate/1.2.0/templates/common.yaml similarity index 100% rename from community/frigate/1.1.7/templates/common.yaml rename to community/frigate/1.2.0/templates/common.yaml