Forráskód Böngészése

linkding: add plus image (#2331)

* linkding: add plus image

* fmt
Stavros Kois 1 éve
szülő
commit
92bf1baec6

+ 1 - 1
library/ix-dev/community/linkding/Chart.yaml

@@ -3,7 +3,7 @@ description: Linkding is a bookmark manager that you can host yourself.
 annotations:
   title: Linkding
 type: application
-version: 1.2.14
+version: 1.2.15
 apiVersion: v2
 appVersion: 1.27.0
 kubeVersion: '>=1.16.0-0'

+ 5 - 4
library/ix-dev/community/linkding/ci/extra-values.yaml

@@ -2,6 +2,7 @@ linkdingNetwork:
   webPort: 31000
 
 linkdingConfig:
+  imageSelector: plusImage
   enableAuthProxy: true
   authProxyUsernameHeader: HTTP_REMOTE_USER
   authProxyLogoutUrl: https://example.com/logout
@@ -22,7 +23,7 @@ linkdingStorage:
       size: ""
 
   additionalStorages:
-  - type: pvc
-    mountPath: /data1
-  - type: pvc
-    mountPath: /data2
+    - type: pvc
+      mountPath: /data1
+    - type: pvc
+      mountPath: /data2

+ 13 - 1
library/ix-dev/community/linkding/questions.yaml

@@ -27,6 +27,18 @@ questions:
     schema:
       type: dict
       attrs:
+        - variable: imageSelector
+          label: Image
+          description: The image to use for Linkding
+          schema:
+            type: string
+            default: image
+            required: true
+            enum:
+              - value: image
+                description: Normal Linkding image
+              - value: plusImage
+                description: Plus Linkding image
         - variable: username
           label: Username
           description: |
@@ -608,7 +620,7 @@ questions:
                 schema:
                   type: string
                   max_length: 12
-                  valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
+                  valid_chars: "^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$"
                   valid_chars_error: |
                     Valid Memory limit formats are</br>
                     - Suffixed with E/P/T/G/M/K - eg. 1G</br>

+ 1 - 1
library/ix-dev/community/linkding/templates/_linkding.tpl

@@ -10,7 +10,7 @@ workload:
         linkding:
           enabled: true
           primary: true
-          imageSelector: image
+          imageSelector: {{ .Values.linkdingConfig.imageSelector | default "image" }}
           securityContext:
             runAsUser: {{ .Values.linkdingRunAs.user }}
             runAsGroup: {{ .Values.linkdingRunAs.group }}

+ 1 - 1
library/ix-dev/community/linkding/upgrade_info.json

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

+ 34 - 10
library/ix-dev/community/linkding/upgrade_strategy

@@ -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 = re.compile(r'\d+\.\d+\.\d+')
+ENUMS = {
+    'image': {
+        'RE_STABLE_VERSION': RE_STABLE_VERSION_BASE,
+    },
+    'plusImage': {
+        'RE_STABLE_VERSION': re.compile(rf'{RE_STABLE_VERSION_BASE}-plus'),
+        'STRIP_TEXT': '-plus'
+    },
+}
 
 
 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
+
+        # 16 is the "default" (Also tied to latest tag)
+        if key == 'image':
+            output['app_version'] = version
+
+        output['tags'][key] = tags[version]
+
+    return output
+
 
 if __name__ == '__main__':
     try:

+ 4 - 0
library/ix-dev/community/linkding/values.yaml

@@ -2,6 +2,10 @@ image:
   repository: sissbruecker/linkding
   pullPolicy: IfNotPresent
   tag: 1.27.0
+plusImage:
+  repository: sissbruecker/linkding
+  pullPolicy: IfNotPresent
+  tag: 1.27.0-plus
 
 resources:
   limits: