From 2612f032665e90627450fd95267e06254ed5db10 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:37:36 +0200 Subject: [PATCH] immich - fix upgrade strategy and GPU definition (#2151) * immich - fix upgrade strategy * add gpu to both ML and microservices pods --- library/ix-dev/community/immich/Chart.yaml | 2 +- .../immich/templates/_configuration.tpl | 13 +++++++++++ .../templates/_immich-microservices.tpl | 11 ---------- .../ix-dev/community/immich/upgrade_info.json | 1 - .../ix-dev/community/immich/upgrade_strategy | 22 ++++++++++++++----- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/library/ix-dev/community/immich/Chart.yaml b/library/ix-dev/community/immich/Chart.yaml index 3106cb2695..c57c1f7985 100644 --- a/library/ix-dev/community/immich/Chart.yaml +++ b/library/ix-dev/community/immich/Chart.yaml @@ -4,7 +4,7 @@ description: Immich is a self-hosted photo and video backup solution directly fr annotations: title: Immich type: application -version: 3.0.8 +version: 3.0.9 apiVersion: v2 appVersion: 1.94.1 kubeVersion: '>=1.16.0-0' diff --git a/library/ix-dev/community/immich/templates/_configuration.tpl b/library/ix-dev/community/immich/templates/_configuration.tpl index 58116ce86c..edda9e1a56 100644 --- a/library/ix-dev/community/immich/templates/_configuration.tpl +++ b/library/ix-dev/community/immich/templates/_configuration.tpl @@ -86,4 +86,17 @@ configmap: MACHINE_LEARNING_CACHE_FOLDER: /mlcache TRANSFORMERS_CACHE: /mlcache {{- end }} + +{{- with .Values.immichGPU }} +scaleGPU: + {{- range $key, $value := . }} + - gpu: + {{ $key }}: {{ $value }} + targetSelector: + microservices: + - microservices + machinelearning: + - machinelearning + {{- end -}} +{{- end -}} {{- end -}} diff --git a/library/ix-dev/community/immich/templates/_immich-microservices.tpl b/library/ix-dev/community/immich/templates/_immich-microservices.tpl index fe437d63dc..c0c144e827 100644 --- a/library/ix-dev/community/immich/templates/_immich-microservices.tpl +++ b/library/ix-dev/community/immich/templates/_immich-microservices.tpl @@ -45,15 +45,4 @@ workload: {{- include "ix.v1.common.app.redisWait" (dict "name" "redis-wait" "secretName" "redis-creds") | nindent 8 }} {{- include "immich.wait.init" (dict "url" $url) | indent 8 }} - -{{- with .Values.immichGPU }} -scaleGPU: - {{- range $key, $value := . }} - - gpu: - {{ $key }}: {{ $value }} - targetSelector: - microservices: - - microservices - {{- end -}} -{{- end -}} {{- end -}} diff --git a/library/ix-dev/community/immich/upgrade_info.json b/library/ix-dev/community/immich/upgrade_info.json index 140dbab1f7..6b71e95233 100644 --- a/library/ix-dev/community/immich/upgrade_info.json +++ b/library/ix-dev/community/immich/upgrade_info.json @@ -1,7 +1,6 @@ { "filename": "values.yaml", "keys": [ - "pgvectorImage", "image", "mlImage", "mlCudaImage", diff --git a/library/ix-dev/community/immich/upgrade_strategy b/library/ix-dev/community/immich/upgrade_strategy index a1b0f56a80..e49a550b31 100755 --- a/library/ix-dev/community/immich/upgrade_strategy +++ b/library/ix-dev/community/immich/upgrade_strategy @@ -8,10 +8,22 @@ from catalog_update.upgrade_strategy import semantic_versioning RE_STABLE_VERSION_BASE = r'\d+\.\d+\.\d+' ENUMS = { - 'default': { + 'image': { 'RE_STABLE_VERSION': re.compile(rf'v{RE_STABLE_VERSION_BASE}'), 'STRIP_TEXT': 'v' }, + 'mlImage': { + 'RE_STABLE_VERSION': re.compile(rf'v{RE_STABLE_VERSION_BASE}'), + 'STRIP_TEXT': 'v' + }, + 'mlCudaImage': { + 'RE_STABLE_VERSION': re.compile(rf'v{RE_STABLE_VERSION_BASE}-cuda'), + 'STRIP_TEXT': 'v' + }, + 'mlOpenvinoImage': { + 'RE_STABLE_VERSION': re.compile(rf'v{RE_STABLE_VERSION_BASE}-openvino'), + 'STRIP_TEXT': 'v' + }, 'pgvectorImage': { 'RE_STABLE_VERSION': re.compile(rf'pg15-v{RE_STABLE_VERSION_BASE}'), 'STRIP_TEXT': 'pg15-v' @@ -20,7 +32,7 @@ ENUMS = { def strip_text(key, STRIP_TEXT): - key = key.replace('cuda', '').replace('openvino', '') + key = key.replace('-cuda', '').replace('-openvino', '') return key.strip(STRIP_TEXT) @@ -32,10 +44,8 @@ def newer_mapping(image_tags): } for key in image_tags.keys(): - STRIP_TEXT = ENUMS[key].get('STRIP_TEXT', None) \ - if key in ENUMS else ENUMS.get('default', None).get('STRIP_TEXT', None) - RE_STABLE_VERSION = ENUMS[key].get('RE_STABLE_VERSION') \ - if key in ENUMS else ENUMS.get('default', None).get('RE_STABLE_VERSION', None) + STRIP_TEXT = ENUMS[key].get('STRIP_TEXT', None) + RE_STABLE_VERSION = ENUMS[key].get('RE_STABLE_VERSION') if (STRIP_TEXT is None) or (RE_STABLE_VERSION is None): continue