Sfoglia il codice sorgente

Add `castopod` to `incubator` train (#1598)

* initial commit

* add some templates

* add common and templates

* update strategy

* fix tempaltes

* fix host

* add metadata

* add readme

* fix probe

* add questiosn

* typo

* quote

* disable by default the redirect

* add another test

* rename service

* remove todo

* fix backend url and questions
Stavros Kois 1 anno fa
parent
commit
f4a842b162
25 ha cambiato i file con 921 aggiunte e 0 eliminazioni
  1. 6 0
      library/ix-dev/community/castopod/Chart.lock
  2. 25 0
      library/ix-dev/community/castopod/Chart.yaml
  3. 3 0
      library/ix-dev/community/castopod/README.md
  4. 3 0
      library/ix-dev/community/castopod/app-readme.md
  5. BIN
      library/ix-dev/community/castopod/charts/common-1.1.1.tgz
  6. 17 0
      library/ix-dev/community/castopod/ci/2fa-values.yaml
  7. 16 0
      library/ix-dev/community/castopod/ci/basic-values.yaml
  8. 23 0
      library/ix-dev/community/castopod/ci/extra-values.yaml
  9. 18 0
      library/ix-dev/community/castopod/ci/https-redirect-values.yaml
  10. 7 0
      library/ix-dev/community/castopod/item.yaml
  11. 18 0
      library/ix-dev/community/castopod/metadata.yaml
  12. 332 0
      library/ix-dev/community/castopod/questions.yaml
  13. 1 0
      library/ix-dev/community/castopod/templates/NOTES.txt
  14. 56 0
      library/ix-dev/community/castopod/templates/_castopod.tpl
  15. 68 0
      library/ix-dev/community/castopod/templates/_configuration.tpl
  16. 6 0
      library/ix-dev/community/castopod/templates/_mariadb.tpl
  17. 62 0
      library/ix-dev/community/castopod/templates/_persistance.tpl
  18. 41 0
      library/ix-dev/community/castopod/templates/_portal.tpl
  19. 6 0
      library/ix-dev/community/castopod/templates/_redis.tpl
  20. 49 0
      library/ix-dev/community/castopod/templates/_service.tpl
  21. 60 0
      library/ix-dev/community/castopod/templates/_web.tpl
  22. 15 0
      library/ix-dev/community/castopod/templates/common.yaml
  23. 1 0
      library/ix-dev/community/castopod/upgrade_info.json
  24. 51 0
      library/ix-dev/community/castopod/upgrade_strategy
  25. 37 0
      library/ix-dev/community/castopod/values.yaml

+ 6 - 0
library/ix-dev/community/castopod/Chart.lock

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../common
+  version: 1.1.1
+digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7
+generated: "2023-10-02T16:38:49.597098778+03:00"

+ 25 - 0
library/ix-dev/community/castopod/Chart.yaml

@@ -0,0 +1,25 @@
+name: castopod
+description: Castopod is an open-source hosting platform made for podcasters who want engage and interact with their audience.
+annotations:
+  title: Castopod
+type: application
+version: 1.0.0
+apiVersion: v2
+appVersion: 1.6.5
+kubeVersion: '>=1.16.0-0'
+maintainers:
+  - name: truenas
+    url: https://www.truenas.com/
+    email: dev@ixsystems.com
+dependencies:
+  - name: common
+    repository: file://../../../common
+    version: 1.1.1
+home: https://castopod.org
+icon: https://docs.castopod.org/images/castopod-logo-inline.svg
+sources:
+  - https://hub.docker.com/r/castopod/castopod
+  - https://github.com/truenas/charts/tree/master/community/castopod
+  - https://code.castopod.org/adaures/castopod
+keywords:
+  - podcast

+ 3 - 0
library/ix-dev/community/castopod/README.md

@@ -0,0 +1,3 @@
+# Castopod
+
+[Castopod](https://castopod.org) is an open-source hosting platform made for podcasters who want engage and interact with their audience.

+ 3 - 0
library/ix-dev/community/castopod/app-readme.md

@@ -0,0 +1,3 @@
+# Castopod
+
+[Castopod](https://castopod.org) is an open-source hosting platform made for podcasters who want engage and interact with their audience.

BIN
library/ix-dev/community/castopod/charts/common-1.1.1.tgz


+ 17 - 0
library/ix-dev/community/castopod/ci/2fa-values.yaml

@@ -0,0 +1,17 @@
+castopodConfig:
+  baseUrl: http://localhost:31000
+  enable2fa: true
+
+castopodNetwork:
+  webPort: 31000
+
+castopodStorage:
+  data:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/data
+  mariadbData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbData
+  mariadbBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbBackup

+ 16 - 0
library/ix-dev/community/castopod/ci/basic-values.yaml

@@ -0,0 +1,16 @@
+castopodConfig:
+  baseUrl: http://localhost:31000
+
+castopodNetwork:
+  webPort: 31000
+
+castopodStorage:
+  data:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/data
+  mariadbData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbData
+  mariadbBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbBackup

+ 23 - 0
library/ix-dev/community/castopod/ci/extra-values.yaml

@@ -0,0 +1,23 @@
+castopodConfig:
+  baseUrl: http://localhost:31000
+
+castopodNetwork:
+  webPort: 31000
+
+castopodStorage:
+  data:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/data
+  mariadbData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbData
+  mariadbBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbBackup
+  additionalStorages:
+  - type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/data1
+    mountPath: /data1
+  - type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/data2
+    mountPath: /data2

+ 18 - 0
library/ix-dev/community/castopod/ci/https-redirect-values.yaml

@@ -0,0 +1,18 @@
+castopodConfig:
+  baseUrl: http://localhost:31000
+  disableHttpsRedirect: false
+  enable2fa: true
+
+castopodNetwork:
+  webPort: 31000
+
+castopodStorage:
+  data:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/data
+  mariadbData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbData
+  mariadbBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbBackup

+ 7 - 0
library/ix-dev/community/castopod/item.yaml

@@ -0,0 +1,7 @@
+icon_url: https://docs.castopod.org/images/castopod-logo-inline.svg
+categories:
+  - media
+screenshots:
+  - https://castopod.org/_astro/castopod-activity-screen.71de6d2e.webp
+tags:
+  - podcast

+ 18 - 0
library/ix-dev/community/castopod/metadata.yaml

@@ -0,0 +1,18 @@
+runAsContext:
+  - userName: root
+    groupName: root
+    gid: 0
+    uid: 0
+    description: Castopod run as root user
+capabilities:
+  - name: CHOWN
+    description: Castopod is able to chown files.
+  - name: DAC_OVERRIDE
+    description: Castopod is able to bypass permission checks.
+  - name: FOWNER
+    description: Castopod is able bypass permission checks for it's sub-processes.
+  - name: SETGID
+    description: Castopod is able to set group ID for it's sub-processes.
+  - name: SETUID
+    description: Castopod is able to set user ID for it's sub-processes.
+hostMounts: []

+ 332 - 0
library/ix-dev/community/castopod/questions.yaml

@@ -0,0 +1,332 @@
+groups:
+  - name: Castopod Configuration
+    description: Configure Castopod
+  - name: Network Configuration
+    description: Configure Network for Castopod
+  - name: Storage Configuration
+    description: Configure Storage for Castopod
+  - name: Resources Configuration
+    description: Configure Resources for Castopod
+
+portals:
+  web_portal:
+    protocols:
+      - "$kubernetes-resource_configmap_portal_protocol"
+    host:
+      - "$kubernetes-resource_configmap_portal_host"
+    ports:
+      - "$kubernetes-resource_configmap_portal_port"
+    path: "$kubernetes-resource_configmap_portal_path"
+  admin:
+    protocols:
+      - "$kubernetes-resource_configmap_portal_protocol"
+    host:
+      - "$kubernetes-resource_configmap_portal_host"
+    ports:
+      - "$kubernetes-resource_configmap_portal_port"
+    path: "$kubernetes-resource_configmap_portal_admin"
+
+questions:
+  - variable: castopodConfig
+    label: ""
+    group: Castopod Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: baseUrl
+          label: Base URL
+          description: |
+            The base URL for Castopod.</br>
+            Example: http://your.server.ip:30085
+          schema:
+            type: uri
+            required: true
+            default: ""
+        - variable: webTimeout
+          label: Web Timeout
+          description: The timeout for Castopod requests in seconds.
+          schema:
+            type: int
+            required: true
+            default: 900
+            min: 1
+        - variable: webMaxBodySize
+          label: Web Max Body Size
+          description: The maximum body size for Castopod requests in megabytes.
+          schema:
+            type: int
+            required: true
+            default: 512
+            min: 1
+        - variable: phpMemoryLimit
+          label: PHP Memory Limit
+          description: The PHP memory limit for Castopod.
+          schema:
+            type: int
+            required: true
+            default: 512
+            min: 1
+        - variable: enable2fa
+          label: Enable 2FA
+          description: Enable 2FA for Castopod.
+          schema:
+            type: boolean
+            default: false
+        - variable: disableHttpsRedirect
+          label: Disable HTTPS Redirect
+          description: |
+            Disable HTTPS redirect for Castopod. </br>
+            This is useful if you are using a reverse proxy with HTTPS.
+          schema:
+            type: boolean
+            default: true
+        - variable: additionalEnvs
+          label: Additional Environment Variables
+          description: Configure additional environment variables for Castopod.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: env
+                label: Environment Variable
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: name
+                      label: Name
+                      schema:
+                        type: string
+                        required: true
+                    - variable: value
+                      label: Value
+                      schema:
+                        type: string
+                        required: true
+
+  - variable: castopodNetwork
+    label: ""
+    group: Network Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: webPort
+          label: Web Port
+          description: The port for the Castopod WebUI.
+          schema:
+            type: int
+            default: 30085
+            min: 9000
+            max: 65535
+            required: true
+
+  - variable: castopodStorage
+    label: ""
+    group: Storage Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: data
+          label: Castopod Data Storage
+          description: The path to store Castopod data.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: ixVolume
+                  enum:
+                    - value: hostPath
+                      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
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "data"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: mariadbData
+          label: Castopod MariaDB Data Storage
+          description: The path to store Castopod MariaDB Data.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: ixVolume
+                  enum:
+                    - value: hostPath
+                      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
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: mariadbData
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: mariadbBackup
+          label: Castopod MariaDB Backup Storage
+          description: The path to store Castopod MariaDB Backup.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: ixVolume
+                  enum:
+                    - value: hostPath
+                      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
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: mariadbBackup
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: additionalStorages
+          label: Additional Storage
+          description: Additional storage for Castopod.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: storageEntry
+                label: Storage Entry
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: type
+                      label: Type
+                      description: |
+                        ixVolume: Is dataset created automatically by the system.</br>
+                        Host Path: Is a path that already exists on the system.
+                      schema:
+                        type: string
+                        required: true
+                        default: "ixVolume"
+                        enum:
+                          - value: "hostPath"
+                            description: Host Path (Path that already exists on the system)
+                          - value: "ixVolume"
+                            description: ixVolume (Dataset created automatically by the system)
+                    - 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.
+                      schema:
+                        type: hostpath
+                        show_if: [["type", "=", "hostPath"]]
+                        required: true
+                    - variable: datasetName
+                      label: Dataset Name
+                      description: The name of the dataset to use for storage.
+                      schema:
+                        type: string
+                        show_if: [["type", "=", "ixVolume"]]
+                        required: true
+                        immutable: true
+                        default: "storage_entry"
+                        $ref:
+                          - "normalize/ixVolume"
+
+  - variable: resources
+    label: ""
+    group: Resources Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: limits
+          label: Limits
+          schema:
+            type: dict
+            attrs:
+              - variable: cpu
+                label: CPU
+                description: CPU limit for Castopod.
+                schema:
+                  type: string
+                  max_length: 6
+                  valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
+                  valid_chars_error: |
+                    Valid CPU limit formats are</br>
+                    - Plain Integer - eg. 1</br>
+                    - Float - eg. 0.5</br>
+                    - Milicpu - eg. 500m
+                  default: "4000m"
+                  required: true
+              - variable: memory
+                label: Memory
+                description: Memory limit for Castopod.
+                schema:
+                  type: string
+                  max_length: 12
+                  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>
+                    - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
+                    - Plain Integer in bytes - eg. 1024</br>
+                    - Exponent - eg. 134e6
+                  default: "8Gi"
+                  required: true

+ 1 - 0
library/ix-dev/community/castopod/templates/NOTES.txt

@@ -0,0 +1 @@
+{{ include "ix.v1.common.lib.chart.notes" $ }}

+ 56 - 0
library/ix-dev/community/castopod/templates/_castopod.tpl

@@ -0,0 +1,56 @@
+{{- define "castopod.workload" -}}
+workload:
+  castopod:
+    enabled: true
+    primary: true
+    type: Deployment
+    podSpec:
+      hostNetwork: false
+      containers:
+        castopod:
+          enabled: true
+          primary: true
+          imageSelector: image
+          securityContext:
+            runAsUser: 0
+            runAsGroup: 0
+            runAsNonRoot: false
+            readOnlyRootFilesystem: false
+            capabilities:
+              add:
+                - CHOWN
+                - DAC_OVERRIDE
+                - FOWNER
+                - SETGID
+                - SETUID
+          envFrom:
+            - secretRef:
+                name: castopod-creds
+            - configMapRef:
+                name: castopod-config
+          {{ with .Values.castopodConfig.additionalEnvs }}
+          envList:
+            {{ range $env := . }}
+            - name: {{ $env.name }}
+              value: {{ $env.value }}
+            {{ end }}
+          {{ end }}
+          probes:
+            liveness:
+              enabled: true
+              type: tcp
+              port: 9000
+            readiness:
+              enabled: true
+              type: tcp
+              port: 9000
+            startup:
+              enabled: true
+              type: tcp
+              port: 9000
+      initContainers:
+      {{- include "ix.v1.common.app.redisWait" (dict  "name" "01-redis-wait"
+                                                      "secretName" "redis-creds") | nindent 8 }}
+      {{- include "ix.v1.common.app.mariadbWait" (dict "name" "02-mariadb-wait"
+                                                       "secretName" "mariadb-creds") | nindent 8 }}
+{{- end -}}

+ 68 - 0
library/ix-dev/community/castopod/templates/_configuration.tpl

@@ -0,0 +1,68 @@
+{{- define "castopod.configuration" -}}
+
+  {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
+
+  {{- $saltKey := randAlphaNum 64 -}}
+  {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-castopod-creds" $fullname)) -}}
+    {{- $saltKey = ((index .data "CP_ANALYTICS_SALT") | b64dec) -}}
+  {{- end -}}
+
+  {{- $redisHost := (printf "%s-redis" $fullname) -}}
+
+  {{- $redisPass := randAlphaNum 32 -}}
+  {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-redis-creds" $fullname)) -}}
+    {{- $redisPass = ((index .data "REDIS_PASSWORD") | b64dec) -}}
+  {{- end -}}
+
+  {{- $dbHost := (printf "%s-mariadb" $fullname) -}}
+  {{- $dbUser := "castopod" -}}
+  {{- $dbName := "castopod" -}}
+
+  {{- $dbPass := (randAlphaNum 32) -}}
+  {{- $dbRootPass := (randAlphaNum 32) -}}
+  {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-mariadb-creds" $fullname)) -}}
+    {{- $dbPass = ((index .data "MARIADB_PASSWORD") | b64dec) -}}
+    {{- $dbRootPass = ((index .data "MARIADB_ROOT_PASSWORD") | b64dec) -}}
+  {{- end }}
+secret:
+  mariadb-creds:
+    enabled: true
+    data:
+      MARIADB_USER: {{ $dbUser }}
+      MARIADB_DATABASE: {{ $dbName }}
+      MARIADB_PASSWORD: {{ $dbPass }}
+      MARIADB_ROOT_PASSWORD: {{ $dbRootPass }}
+      MARIADB_HOST: {{ $dbHost }}
+  redis-creds:
+    enabled: true
+    data:
+      ALLOW_EMPTY_PASSWORD: "no"
+      REDIS_PASSWORD: {{ $redisPass }}
+      REDIS_HOST: {{ $redisHost }}
+
+  castopod-creds:
+    enabled: true
+    data:
+      CP_ANALYTICS_SALT: {{ $saltKey }}
+      CP_DATABASE_HOSTNAME: {{ $dbHost }}
+      CP_DATABASE_NAME: {{ $dbName }}
+      CP_DATABASE_USERNAME: {{ $dbUser }}
+      CP_DATABASE_PASSWORD: {{ $dbPass }}
+      CP_CACHE_HANDLER: redis
+      CP_REDIS_HOST: {{ $redisHost }}
+      CP_REDIS_PASSWORD: {{ $redisPass }}
+      CP_REDIS_PORT: "6379"
+      CP_REDIS_DATABASE: "0"
+
+configmap:
+  castopod-config:
+    enabled: true
+    data:
+      CP_TIMEOUT: {{ .Values.castopodConfig.webTimeout | quote }}
+      CP_MAX_BODY_SIZE: {{ printf "%vM" .Values.castopodConfig.webMaxBodySize }}
+      CP_PHP_MEMORY_LIMIT: {{ printf "%vM" .Values.castopodConfig.phpMemoryLimit }}
+      CP_BASEURL: {{ .Values.castopodConfig.baseUrl }}
+      CP_MEDIAURL: {{ .Values.castopodConfig.baseUrl }}
+      CP_DISABLE_HTTPS: {{ ternary "1" "0" .Values.castopodConfig.disableHttpsRedirect | quote }}
+      CP_ENABLE_2FA: {{ .Values.castopodConfig.enable2fa | quote }}
+{{- end -}}

+ 6 - 0
library/ix-dev/community/castopod/templates/_mariadb.tpl

@@ -0,0 +1,6 @@
+{{- define "mariadb.workload" -}}
+workload:
+{{- include "ix.v1.common.app.mariadb" (dict "secretName" "mariadb-creds"
+                                              "resources" .Values.resources
+                                              "ixChartContext" .Values.ixChartContext) | nindent 2 }}
+{{- end -}}

+ 62 - 0
library/ix-dev/community/castopod/templates/_persistance.tpl

@@ -0,0 +1,62 @@
+{{- define "castopod.persistence" -}}
+persistence:
+  data:
+    enabled: true
+    type: {{ .Values.castopodStorage.data.type }}
+    datasetName: {{ .Values.castopodStorage.data.datasetName | default "" }}
+    hostPath: {{ .Values.castopodStorage.data.hostPath | default "" }}
+    targetSelector:
+      castopod:
+        castopod:
+          mountPath: /var/www/castopod/public/media
+      web:
+        web:
+          mountPath: /var/www/html/media
+  tmp:
+    enabled: true
+    type: emptyDir
+    targetSelector:
+      castopod:
+        castopod:
+          mountPath: /tmp
+  {{- range $idx, $storage := .Values.castopodStorage.additionalStorages }}
+  {{ printf "castopod-%v" (int $idx) }}:
+    enabled: true
+    type: {{ $storage.type }}
+    datasetName: {{ $storage.datasetName | default "" }}
+    hostPath: {{ $storage.hostPath | default "" }}
+    targetSelector:
+      castopod:
+        castopod:
+          mountPath: {{ $storage.mountPath }}
+  {{- end }}
+
+  mariadbdata:
+    enabled: true
+    type: {{ .Values.castopodStorage.mariadbData.type }}
+    datasetName: {{ .Values.castopodStorage.mariadbData.datasetName | default "" }}
+    hostPath: {{ .Values.castopodStorage.mariadbData.hostPath | default "" }}
+    targetSelector:
+      # MariaDB pod
+      mariadb:
+        # MariaDB container
+        mariadb:
+          mountPath: /var/lib/mysql
+        # MariaDB - Permissions container
+        permissions:
+          mountPath: /mnt/directories/mariadb_data
+  mariadbbackup:
+    enabled: true
+    type: {{ .Values.castopodStorage.mariadbBackup.type }}
+    datasetName: {{ .Values.castopodStorage.mariadbBackup.datasetName | default "" }}
+    hostPath: {{ .Values.castopodStorage.mariadbBackup.hostPath | default "" }}
+    targetSelector:
+      # MariaDB backup pod
+      mariadbbackup:
+        # MariaDB backup container
+        mariadbbackup:
+          mountPath: /mariadb_backup
+        # MariaDB - Permissions container
+        permissions:
+          mountPath: /mnt/directories/mariadb_backup
+{{- end -}}

+ 41 - 0
library/ix-dev/community/castopod/templates/_portal.tpl

@@ -0,0 +1,41 @@
+{{- define "castopod.portal" -}}
+  {{- $adminPath := "/cp-admin" -}}
+  {{- if $.Release.IsInstall -}}
+    {{- $adminPath = "/cp-install" -}}
+  {{- end -}}
+
+  {{- $host := "$node_ip" -}}
+  {{- $port := "" -}}
+  {{- $protocol := "http" -}}
+  {{- if hasPrefix "https://" .Values.castopodConfig.baseUrl -}}
+    {{- $protocol = "https" -}}
+  {{- end -}}
+
+  {{- with .Values.castopodConfig.baseUrl -}} {{/* Trim protocol and trailing slash */}}
+    {{- $host = . | trimPrefix "https://" | trimPrefix "http://" | trimSuffix "/" -}}
+
+    {{- if contains ":" $host -}}
+      {{- $port = (split ":" $host)._1 -}}
+      {{- $host = (split ":" $host)._0 -}}
+    {{- end -}}
+
+    {{- if not $port -}}
+      {{- if eq $protocol "https" -}}
+        {{- $port = "443" -}}
+      {{- else -}}
+        {{- $port = "80" -}}
+      {{- end -}}
+    {{- end -}}
+  {{- end }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: portal
+data:
+  path: /
+  admin: {{ $adminPath }}
+  port: {{ $port | quote }}
+  protocol: {{ $protocol }}
+  host: {{ $host }}
+{{- end -}}

+ 6 - 0
library/ix-dev/community/castopod/templates/_redis.tpl

@@ -0,0 +1,6 @@
+{{- define "redis.workload" -}}
+workload:
+{{- include "ix.v1.common.app.redis" (dict  "secretName" "redis-creds"
+                                            "resources" .Values.resources) | nindent 2 }}
+
+{{- end -}}

+ 49 - 0
library/ix-dev/community/castopod/templates/_service.tpl

@@ -0,0 +1,49 @@
+{{- define "castopod.service" -}}
+service:
+  castopod-web:
+    enabled: true
+    primary: true
+    type: NodePort
+    targetSelector: web
+    ports:
+      webui:
+        enabled: true
+        primary: true
+        port: {{ .Values.castopodNetwork.webPort }}
+        nodePort: {{ .Values.castopodNetwork.webPort }}
+        targetPort: 80
+        targetSelector: web
+  castopod-api:
+    enabled: true
+    type: ClusterIP
+    targetSelector: castopod
+    ports:
+      api:
+        enabled: true
+        primary: true
+        port: 9000
+        targetPort: 9000
+        targetSelector: castopod
+  mariadb:
+    enabled: true
+    type: ClusterIP
+    targetSelector: mariadb
+    ports:
+      mariadb:
+        enabled: true
+        primary: true
+        port: 3306
+        targetPort: 3306
+        targetSelector: mariadb
+  redis:
+    enabled: true
+    type: ClusterIP
+    targetSelector: redis
+    ports:
+      redis:
+        enabled: true
+        primary: true
+        port: 6379
+        targetPort: 6379
+        targetSelector: redis
+{{- end -}}

+ 60 - 0
library/ix-dev/community/castopod/templates/_web.tpl

@@ -0,0 +1,60 @@
+{{- define "castopod.web.workload" -}}
+{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
+{{- $backend := printf "%s-castopod-api" $fullname }}
+workload:
+  web:
+    enabled: true
+    type: Deployment
+    podSpec:
+      hostNetwork: false
+      containers:
+        web:
+          enabled: true
+          primary: true
+          imageSelector: webImage
+          securityContext:
+            runAsUser: 0
+            runAsGroup: 0
+            runAsNonRoot: false
+            readOnlyRootFilesystem: false
+            capabilities:
+              add:
+                - CHOWN
+                - SETGID
+                - SETUID
+          env:
+            CP_APP_HOSTNAME: {{ $backend }}
+            CP_TIMEOUT: {{ .Values.castopodConfig.webTimeout }}
+            CP_MAX_BODY_SIZE: {{ printf "%vM" .Values.castopodConfig.webMaxBodySize }}
+          probes:
+            liveness:
+              enabled: true
+              type: http
+              path: /health
+              port: 80
+            readiness:
+              enabled: true
+              type: http
+              path: /health
+              port: 80
+            startup:
+              enabled: true
+              type: http
+              path: /health
+              port: 80
+      initContainers:
+        wait-server:
+          enabled: true
+          type: init
+          imageSelector: bashImage
+          command:
+            - bash
+          args:
+            - -c
+            - |
+              echo "Waiting for backend to be ready at [{{ $backend }}:9000]"
+              until nc -vz -w 5 "{{ $backend }}" 9000; do
+                echo "Waiting for backend to be ready at [{{ $backend }}:9000]"
+                sleep 1
+              done
+{{- end -}}

+ 15 - 0
library/ix-dev/community/castopod/templates/common.yaml

@@ -0,0 +1,15 @@
+{{- include "ix.v1.common.loader.init" . -}}
+
+{{/* Merge the templates with Values */}}
+{{- $_ := mustMergeOverwrite .Values (include "castopod.configuration" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "castopod.persistence" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "castopod.service" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "castopod.workload" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "castopod.web.workload" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "mariadb.workload" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "redis.workload" $ | fromYaml) -}}
+
+{{/* Create the configmap for portal manually*/}}
+{{- include "castopod.portal" $ -}}
+
+{{- include "ix.v1.common.loader.apply" . -}}

+ 1 - 0
library/ix-dev/community/castopod/upgrade_info.json

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

+ 51 - 0
library/ix-dev/community/castopod/upgrade_strategy

@@ -0,0 +1,51 @@
+#!/usr/bin/python3
+import json
+import re
+import sys
+
+from catalog_update.upgrade_strategy import semantic_versioning
+
+RE_STABLE_VERSION_BASE = r'\d+\.\d+\.\d+'
+ENUMS = {
+    'image': {
+        'RE_STABLE_VERSION': re.compile(rf'{RE_STABLE_VERSION_BASE}'),
+    },
+    'webImage': {
+        'RE_STABLE_VERSION': re.compile(rf'{RE_STABLE_VERSION_BASE}'),
+    },
+}
+
+
+def newer_mapping(image_tags):
+    output = {
+        "tags": {},
+        "app_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__':
+    try:
+        versions_json = json.loads(sys.stdin.read())
+    except ValueError:
+        raise ValueError('Invalid json specified')
+
+    print(json.dumps(newer_mapping(versions_json)))

+ 37 - 0
library/ix-dev/community/castopod/values.yaml

@@ -0,0 +1,37 @@
+image:
+  repository: castopod/app
+  pullPolicy: IfNotPresent
+  tag: 1.6.5
+webImage:
+  repository: castopod/web-server
+  pullPolicy: IfNotPresent
+  tag: 1.6.5
+
+resources:
+  limits:
+    cpu: 4000m
+    memory: 8Gi
+
+castopodConfig:
+  baseUrl: http://localhost:30085
+  webTimeout: 900
+  webMaxBodySize: 512
+  phpMemoryLimit: 512
+  enable2fa: false
+  disableHttpsRedirect: true
+  additionalEnvs: []
+
+castopodNetwork:
+  webPort: 30085
+
+castopodStorage:
+  data:
+    type: ixVolume
+    datasetName: data
+  mariadbData:
+    type: ixVolume
+    datasetName: mariadbData
+  mariadbBackup:
+    type: ixVolume
+    datasetName: mariadbBackup
+  additionalStorages: []