Procházet zdrojové kódy

update vikunja (#2749)

* update vikunja

* remove imports

* typo

* add missing nodePort

* hmm

* major version

* Update _configuration.tpl
Stavros Kois před 1 rokem
rodič
revize
2d457c4e37

+ 3 - 3
library/ix-dev/community/vikunja/Chart.yaml

@@ -3,10 +3,10 @@ description: Vikunja is an open-source, self-hostable to-do app.
 annotations:
   title: Vikunja
 type: application
-version: 1.0.15
+version: 2.0.0
 apiVersion: v2
-appVersion: 0.22.1
-kubeVersion: '>=1.16.0-0'
+appVersion: 0.24.2
+kubeVersion: ">=1.16.0-0"
 maintainers:
   - name: truenas
     url: https://www.truenas.com/

+ 2 - 27
library/ix-dev/community/vikunja/templates/_configuration.tpl

@@ -61,36 +61,11 @@ configmap:
     enabled: true
     data:
       VIKUNJA_SERVICE_TIMEZONE: {{ .Values.TZ }}
-      VIKUNJA_SERVICE_INTERFACE:
       VIKUNJA_REDIS_ENABLED: "true"
       VIKUNJA_KEYVALUE_TYPE: redis
       VIKUNJA_DATABASE_TYPE: postgres
-      VIKUNJA_SERVICE_INTERFACE: {{ printf ":%v" .Values.vikunjaPorts.api | quote }}
+      VIKUNJA_SERVICE_INTERFACE: {{ printf ":%v" .Values.vikunjaNetwork.webPort | quote }}
       VIKUNJA_FILES_MAXSIZE: {{ printf "%vMB" .Values.vikunjaConfig.maxFileSize }}
       VIKUNJA_FILES_BASEPATH: /app/vikunja/files
-      VIKUNJA_SERVICE_FRONTENDURL: {{ printf "%s/" (.Values.vikunjaConfig.url | trimSuffix "/") }}
-
-  vikunja-frontend:
-    enabled: true
-    data:
-      VIKUNJA_HTTP_PORT: {{ .Values.vikunjaPorts.frontHttp | quote }}
-      VIKUNJA_HTTP2_PORT: {{ .Values.vikunjaPorts.frontHttp2 | quote }}
-
-  nginx-config:
-    enabled: true
-    data:
-      nginx-config: |
-        server {
-            listen {{ .Values.vikunjaNetwork.webPort }};
-            location /nginx-health {
-                return 200;
-            }
-            location / {
-                proxy_pass {{ printf "http://%s-frontend:%v" $fullname .Values.vikunjaPorts.frontHttp }};
-            }
-            location ~* ^/(api|dav|\.well-known)/ {
-                proxy_pass {{ printf "http://%s:%v" $fullname .Values.vikunjaPorts.api }};
-                client_max_body_size {{ printf "%vM" .Values.vikunjaConfig.maxFileSize }};
-            }
-        }
+      VIKUNJA_SERVICE_PUBLICURL: {{ printf "%s/" (.Values.vikunjaConfig.url | trimSuffix "/") }}
 {{- end -}}

+ 2 - 27
library/ix-dev/community/vikunja/templates/_persistence.tpl

@@ -4,23 +4,9 @@ persistence:
     enabled: true
     type: emptyDir
     targetSelector:
-      vikunja:
-        vikunja:
+      vikunja-api:
+        vikunja-api:
           mountPath: /tmp
-  nginxvar:
-    enabled: true
-    type: emptyDir
-    targetSelector:
-      vikunja-proxy:
-        vikunja-proxy:
-          mountPath: /var/cache/nginx
-  nginxrun:
-    enabled: true
-    type: emptyDir
-    targetSelector:
-      vikunja-proxy:
-        vikunja-proxy:
-          mountPath: /var/run
   data:
     enabled: true
     {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.vikunjaStorage.data) | nindent 4 }}
@@ -33,17 +19,6 @@ persistence:
         01-permissions:
           mountPath: /mnt/directories/data
         {{- end }}
-  nginx:
-    enabled: true
-    type: configmap
-    objectName: nginx-config
-    defaultMode: "0600"
-    targetSelector:
-      vikunja-proxy:
-        vikunja-proxy:
-          mountPath: /etc/nginx/conf.d/default.conf
-          subPath: nginx-config
-          readOnly: true
 
   {{- range $idx, $storage := .Values.vikunjaStorage.additionalStorages }}
   {{ printf "vikunja-%v" (int $idx) }}:

+ 3 - 23
library/ix-dev/community/vikunja/templates/_service.tpl

@@ -1,37 +1,17 @@
 {{- define "vikunja.service" -}}
 service:
-  vikunja:
+  vikunja-api:
     enabled: true
     primary: true
-    type: ClusterIP
+    type: NodePort
     targetSelector: vikunja-api
     ports:
       api:
-        enabled: true
-        primary: true
-        port: {{ .Values.vikunjaPorts.api }}
-        targetSelector: vikunja-api
-  proxy:
-    enabled: true
-    type: NodePort
-    targetSelector: vikunja-proxy
-    ports:
-      webui:
         enabled: true
         primary: true
         port: {{ .Values.vikunjaNetwork.webPort }}
         nodePort: {{ .Values.vikunjaNetwork.webPort }}
-        targetSelector: vikunja-proxy
-  frontend:
-    enabled: true
-    type: ClusterIP
-    targetSelector: vikunja-frontend
-    ports:
-      webui:
-        enabled: true
-        primary: true
-        port: {{ .Values.vikunjaPorts.frontHttp }}
-        targetSelector: vikunja-frontend
+        targetSelector: vikunja-api
   redis:
     enabled: true
     type: ClusterIP

+ 3 - 7
library/ix-dev/community/vikunja/templates/_vikunja_api.tpl

@@ -15,10 +15,6 @@ workload:
             runAsUser: {{ .Values.vikunjaRunAs.user }}
             runAsGroup: {{ .Values.vikunjaRunAs.group }}
             runAsNonRoot: false
-          env:
-            # Make vikunja skip user creation
-            PUID: ""
-            PGID: ""
           envFrom:
             - secretRef:
                 name: vikunja-creds
@@ -35,17 +31,17 @@ workload:
             liveness:
               enabled: true
               type: http
-              port: {{ .Values.vikunjaPorts.api }}
+              port: {{ .Values.vikunjaNetwork.webPort }}
               path: /health
             readiness:
               enabled: true
               type: http
-              port: {{ .Values.vikunjaPorts.api }}
+              port: {{ .Values.vikunjaNetwork.webPort }}
               path: /health
             startup:
               enabled: true
               type: http
-              port: {{ .Values.vikunjaPorts.api }}
+              port: {{ .Values.vikunjaNetwork.webPort }}
               path: /health
       initContainers:
       {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"

+ 0 - 40
library/ix-dev/community/vikunja/templates/_vikunja_frontend.tpl

@@ -1,40 +0,0 @@
-{{- define "vikunja.frontend" -}}
-{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
-{{- $apiUrl := printf "http://%v:%v/health" $fullname .Values.vikunjaPorts.api }}
-workload:
-  vikunja-frontend:
-    enabled: true
-    type: Deployment
-    podSpec:
-      hostNetwork: false
-      containers:
-        vikunja-frontend:
-          enabled: true
-          primary: true
-          imageSelector: frontendImage
-          securityContext:
-            runAsUser: 101
-            runAsGroup: 101
-            readOnlyRootFilesystem: false
-          envFrom:
-            - configMapRef:
-                name: vikunja-frontend
-          probes:
-            liveness:
-              enabled: true
-              type: http
-              port: {{ .Values.vikunjaPorts.frontHttp }}
-              path: /ready
-            readiness:
-              enabled: true
-              type: http
-              port: {{ .Values.vikunjaPorts.frontHttp }}
-              path: /ready
-            startup:
-              enabled: true
-              type: http
-              port: {{ .Values.vikunjaPorts.frontHttp }}
-              path: /ready
-      initContainers:
-      {{- include "vikunja.wait.init" (dict "url" $apiUrl) | indent 8 }}
-{{- end -}}

+ 0 - 36
library/ix-dev/community/vikunja/templates/_vikunja_nginx.tpl

@@ -1,36 +0,0 @@
-{{- define "vikunja.nginx" -}}
-{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
-{{- $frontUrl := printf "http://%v-frontend:%v/ready" $fullname .Values.vikunjaPorts.frontHttp }}
-workload:
-  vikunja-proxy:
-    enabled: true
-    type: Deployment
-    podSpec:
-      hostNetwork: false
-      containers:
-        vikunja-proxy:
-          enabled: true
-          primary: true
-          imageSelector: nginxImage
-          securityContext:
-            runAsUser: 101
-            runAsGroup: 101
-          probes:
-            liveness:
-              enabled: true
-              type: http
-              port: {{ .Values.vikunjaNetwork.webPort }}
-              path: /nginx-health
-            readiness:
-              enabled: true
-              type: http
-              port: {{ .Values.vikunjaNetwork.webPort }}
-              path: /nginx-health
-            startup:
-              enabled: true
-              type: http
-              port: {{ .Values.vikunjaNetwork.webPort }}
-              path: /nginx-health
-      initContainers:
-      {{- include "vikunja.wait.init" (dict "url" $frontUrl) | indent 8 }}
-{{- end -}}

+ 0 - 17
library/ix-dev/community/vikunja/templates/_wait-url.tpl

@@ -1,17 +0,0 @@
-{{- define "vikunja.wait.init" -}}
-{{- $url := .url }}
-wait-url:
-  enabled: true
-  type: init
-  imageSelector: bashImage
-  command:
-    - /bin/ash
-    - -c
-    - |
-      echo "Pinging [{{ $url }}] until it is ready..."
-      until wget --spider --quiet "{{ $url }}"; do
-        echo "Waiting for [{{ $url }}] to be ready..."
-        sleep 2
-      done
-      echo "URL [{{ $url }}] is ready!"
-{{- end -}}

+ 0 - 2
library/ix-dev/community/vikunja/templates/common.yaml

@@ -6,8 +6,6 @@
 {{- $_ := mustMergeOverwrite .Values (include "vikunja.service" $ | fromYaml) -}}
 {{- $_ := mustMergeOverwrite .Values (include "vikunja.redis" $ | fromYaml) -}}
 {{- $_ := mustMergeOverwrite .Values (include "vikunja.postgres" $ | fromYaml) -}}
-{{- $_ := mustMergeOverwrite .Values (include "vikunja.nginx" $ | fromYaml) -}}
-{{- $_ := mustMergeOverwrite .Values (include "vikunja.frontend" $ | fromYaml) -}}
 {{- $_ := mustMergeOverwrite .Values (include "vikunja.api" $ | fromYaml) -}}
 
 {{/* Create the configmap for portal manually*/}}

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

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

+ 12 - 35
library/ix-dev/community/vikunja/upgrade_strategy

@@ -6,49 +6,26 @@ import sys
 from catalog_update.upgrade_strategy import semantic_versioning
 
 
-RE_STABLE_VERSION = re.compile(r'\d+\.\d+\.\d+')
-ENUMS = {
-    'image': {
-        'RE_STABLE_VERSION': RE_STABLE_VERSION,
-    },
-    'frontendImage': {
-        'RE_STABLE_VERSION': RE_STABLE_VERSION,
-    },
-    'nginxImage': {
-        'RE_STABLE_VERSION': RE_STABLE_VERSION,
-    },
-}
+RE_STABLE_VERSION = re.compile(r"\d+\.\d+\.\d+")
 
 
 def newer_mapping(image_tags):
-    output = {
-        "tags": {},
-        "app_version": ""
+    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,
     }
 
-    for key in image_tags.keys():
-        RE_STABLE_VERSION = ENUMS[key].get('RE_STABLE_VERSION', None) if key in ENUMS else None
-        if (RE_STABLE_VERSION is None):
-            continue
 
-        tags = {t: 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__':
+if __name__ == "__main__":
     try:
         versions_json = json.loads(sys.stdin.read())
     except ValueError:
-        raise ValueError('Invalid json specified')
+        raise ValueError("Invalid json specified")
 
     print(json.dumps(newer_mapping(versions_json)))

+ 3 - 18
library/ix-dev/community/vikunja/values.yaml

@@ -1,15 +1,7 @@
 image:
-  repository: vikunja/api
+  repository: vikunja/vikunja
   pullPolicy: IfNotPresent
-  tag: 0.22.1
-frontendImage:
-  repository: vikunja/frontend
-  pullPolicy: IfNotPresent
-  tag: 0.22.1
-nginxImage:
-  repository: nginx
-  pullPolicy: IfNotPresent
-  tag: 1.27.1
+  tag: 0.24.2
 
 resources:
   limits:
@@ -17,7 +9,7 @@ resources:
     memory: 8Gi
 
 vikunjaConfig:
-  url: ''
+  url: ""
   maxFileSize: 20
   additionalEnvs: []
 
@@ -60,10 +52,3 @@ notes:
     </details>
     {{- $_ := unset .Values "vikunjaDbPass" }}
     {{- $_ := unset .Values "vikunjaDbHost" }}
-
-# Not exposed to the user,
-# just used internally
-vikunjaPorts:
-  api: 3456
-  frontHttp: 5000
-  frontHttp2: 5001