Browse Source

immich - allow different ml images (#2146)

* immich - allow different ml images

* flake
Stavros Kois 1 năm trước cách đây
mục cha
commit
bb39bd95ff

+ 1 - 1
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.7
+version: 3.0.8
 apiVersion: v2
 appVersion: 1.94.1
 kubeVersion: '>=1.16.0-0'

+ 14 - 1
library/ix-dev/community/immich/questions.yaml

@@ -42,7 +42,20 @@ questions:
           schema:
             type: boolean
             default: true
-
+        - variable: mlImageType
+          label: Machine Learning Image Type
+          description: |
+            The type of image to use for Machine Learning.
+          schema:
+            type: string
+            default: mlImage
+            enum:
+              - value: mlImage
+                description: Default Machine Learning Image
+              - value: mlCudaImage
+                description: Cuda Machine Learning Image
+              - value: mlOpenvinoImage
+                description: Openvino Machine Learning Image
   - variable: immichNetwork
     label: ""
     group: Network Configuration

+ 6 - 2
library/ix-dev/community/immich/templates/_immich-machinelearning.tpl

@@ -1,6 +1,10 @@
 {{- define "immich.machinelearning.workload" -}}
 {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
-{{- $url := printf "http://%v:%v/api/server-info/ping" $fullname .Values.immichNetwork.webuiPort }}
+{{- $url := printf "http://%v:%v/api/server-info/ping" $fullname .Values.immichNetwork.webuiPort -}}
+{{- $img := "mlImage" -}}
+{{- with .Values.immichConfig.mlImage -}}
+  {{- $img = . -}}
+{{- end }}
 workload:
   machinelearning:
     enabled: true
@@ -11,7 +15,7 @@ workload:
         machinelearning:
           enabled: true
           primary: true
-          imageSelector: mlImage
+          imageSelector: {{ $img }}
           securityContext:
             runAsUser: 0
             runAsGroup: 0

+ 7 - 1
library/ix-dev/community/immich/upgrade_info.json

@@ -1,4 +1,10 @@
 {
   "filename": "values.yaml",
-  "keys": ["image", "webImage", "proxyImage", "mlImage"]
+  "keys": [
+    "pgvectorImage",
+    "image",
+    "mlImage",
+    "mlCudaImage",
+    "mlOpenvinoImage"
+  ]
 }

+ 6 - 1
library/ix-dev/community/immich/upgrade_strategy

@@ -19,6 +19,11 @@ ENUMS = {
 }
 
 
+def strip_text(key, STRIP_TEXT):
+    key = key.replace('cuda', '').replace('openvino', '')
+    return key.strip(STRIP_TEXT)
+
+
 def newer_mapping(image_tags):
 
     output = {
@@ -35,7 +40,7 @@ def newer_mapping(image_tags):
         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)}
+        tags = {strip_text(t, STRIP_TEXT): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
         version = semantic_versioning(list(tags))
 
         if not version:

+ 11 - 0
library/ix-dev/community/immich/values.yaml

@@ -8,6 +8,16 @@ mlImage:
   pullPolicy: IfNotPresent
   tag: v1.94.1
 
+mlCudaImage:
+  repository: altran1502/immich-machine-learning
+  pullPolicy: IfNotPresent
+  tag: v1.94.1-cuda
+
+mlOpenvinoImage:
+  repository: altran1502/immich-machine-learning
+  pullPolicy: IfNotPresent
+  tag: v1.94.1-openvino
+
 pgvectorImage:
   repository: tensorchord/pgvecto-rs
   pullPolicy: IfNotPresent
@@ -23,6 +33,7 @@ immichGPU: {}
 immichConfig:
   publicLoginMessage: ''
   enableML: true
+  mlImageType: mlImage
 
 immichNetwork:
   webuiPort: 30041