diff --git a/library/ix-dev/community/kavita/Chart.lock b/library/ix-dev/community/kavita/Chart.lock new file mode 100644 index 0000000000..fbed8d9e5e --- /dev/null +++ b/library/ix-dev/community/kavita/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.1.1 +digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7 +generated: "2023-09-11T15:46:44.44770537+03:00" diff --git a/library/ix-dev/community/kavita/Chart.yaml b/library/ix-dev/community/kavita/Chart.yaml new file mode 100644 index 0000000000..50c3f5fb96 --- /dev/null +++ b/library/ix-dev/community/kavita/Chart.yaml @@ -0,0 +1,26 @@ +name: kavita +description: Kavita is a fast, feature rich, cross platform reading server. +annotations: + title: Kavita +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: 0.7.8 +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://www.kavitareader.com/ +icon: https://github.com/Kareadita/Kavita/blob/develop/UI/Web/src/assets/images/logo.png +sources: + - https://github.com/Kareadita/Kavita + - https://github.com/truenas/charts/tree/master/library/ix-dev/community/kavita + - https://www.kavitareader.com +keywords: + - manga + - ebook diff --git a/library/ix-dev/community/kavita/README.md b/library/ix-dev/community/kavita/README.md new file mode 100644 index 0000000000..aa59dee0c3 --- /dev/null +++ b/library/ix-dev/community/kavita/README.md @@ -0,0 +1,3 @@ +# Kavita + +[Kavita](https://www.kavitareader.com) is a fast, feature rich, cross platform reading server. diff --git a/library/ix-dev/community/kavita/app-readme.md b/library/ix-dev/community/kavita/app-readme.md new file mode 100644 index 0000000000..aa59dee0c3 --- /dev/null +++ b/library/ix-dev/community/kavita/app-readme.md @@ -0,0 +1,3 @@ +# Kavita + +[Kavita](https://www.kavitareader.com) is a fast, feature rich, cross platform reading server. diff --git a/library/ix-dev/community/kavita/charts/common-1.1.1.tgz b/library/ix-dev/community/kavita/charts/common-1.1.1.tgz new file mode 100644 index 0000000000..3eeea5c478 Binary files /dev/null and b/library/ix-dev/community/kavita/charts/common-1.1.1.tgz differ diff --git a/library/ix-dev/community/kavita/ci/basic-values.yaml b/library/ix-dev/community/kavita/ci/basic-values.yaml new file mode 100644 index 0000000000..d0b994539b --- /dev/null +++ b/library/ix-dev/community/kavita/ci/basic-values.yaml @@ -0,0 +1,7 @@ +kavitaNetwork: + webPort: 31000 + +kavitaStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/config diff --git a/library/ix-dev/community/kavita/ci/extra-values.yaml b/library/ix-dev/community/kavita/ci/extra-values.yaml new file mode 100644 index 0000000000..40869366a3 --- /dev/null +++ b/library/ix-dev/community/kavita/ci/extra-values.yaml @@ -0,0 +1,14 @@ +kavitaNetwork: + webPort: 31000 + +kavitaStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/config + additionalStorages: + - type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/manga + mountPath: /manga + - type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/comic + mountPath: /comic diff --git a/library/ix-dev/community/kavita/item.yaml b/library/ix-dev/community/kavita/item.yaml new file mode 100644 index 0000000000..baeda97a08 --- /dev/null +++ b/library/ix-dev/community/kavita/item.yaml @@ -0,0 +1,12 @@ +icon_url: https://github.com/Kareadita/Kavita/blob/develop/UI/Web/src/assets/images/logo.png +categories: + - media +screenshots: + - https://www.kavitareader.com/img/features/homepage.PNG + - https://www.kavitareader.com/img/features/librarydetail_v0.5.4.PNG + - https://www.kavitareader.com/img/features/search_v0.5.4.PNG + - https://www.kavitareader.com/img/features/seriesdetail.PNG + - https://www.kavitareader.com/img/features/mixedchapterandvolumes.PNG +tags: + - ebook + - manga diff --git a/library/ix-dev/community/kavita/metadata.yaml b/library/ix-dev/community/kavita/metadata.yaml new file mode 100644 index 0000000000..f7d6c590ae --- /dev/null +++ b/library/ix-dev/community/kavita/metadata.yaml @@ -0,0 +1,8 @@ +runAsContext: + - userName: root + groupName: root + gid: 0 + uid: 0 + description: Kavita runs as root user. +capabilities: [] +hostMounts: [] diff --git a/library/ix-dev/community/kavita/questions.yaml b/library/ix-dev/community/kavita/questions.yaml new file mode 100644 index 0000000000..eb388b299b --- /dev/null +++ b/library/ix-dev/community/kavita/questions.yaml @@ -0,0 +1,212 @@ +groups: + - name: Kavita Configuration + description: Configure Kavita + - name: Network Configuration + description: Configure Network for Kavita + - name: Storage Configuration + description: Configure Storage for Kavita + - name: Resources Configuration + description: Configure Resources for Kavita + +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" + +questions: + - variable: TZ + group: Kavita Configuration + label: Timezone + schema: + type: string + default: Etc/UTC + required: true + $ref: + - definitions/timezone + + - variable: kavitaConfig + label: "" + group: Kavita Configuration + schema: + type: dict + attrs: + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Kavita. + 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: kavitaNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: webPort + label: Web Port + description: The port for the Kavita Web UI. + schema: + type: int + default: 30069 + min: 9000 + max: 65535 + required: true + + - variable: kavitaStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: config + label: Kavita Config Storage + description: The path to store Kavita Configuration. + schema: + type: dict + attrs: + - variable: type + label: Type + description: | + ixVolume: Is dataset created automatically by the system.
+ 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: "config" + $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 Kavita. + 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.
+ 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 + group: Resources Configuration + label: "" + schema: + type: dict + attrs: + - variable: limits + label: Limits + schema: + type: dict + attrs: + - variable: cpu + label: CPU + description: CPU limit for Kavita. + 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
+ - Plain Integer - eg. 1
+ - Float - eg. 0.5
+ - Milicpu - eg. 500m + default: "4000m" + required: true + - variable: memory + label: Memory + description: Memory limit for Kavita. + 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
+ - Suffixed with E/P/T/G/M/K - eg. 1G
+ - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi
+ - Plain Integer in bytes - eg. 1024
+ - Exponent - eg. 134e6 + default: "8Gi" + required: true diff --git a/library/ix-dev/community/kavita/templates/NOTES.txt b/library/ix-dev/community/kavita/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/kavita/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/kavita/templates/_kavita.tpl b/library/ix-dev/community/kavita/templates/_kavita.tpl new file mode 100644 index 0000000000..da71f14a9e --- /dev/null +++ b/library/ix-dev/community/kavita/templates/_kavita.tpl @@ -0,0 +1,42 @@ +{{- define "kavita.workload" -}} +workload: + kavita: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: false + containers: + kavita: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false + readOnlyRootFilesystem: false + {{ with .Values.kavitaConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: http + port: 5000 + path: /api/health + readiness: + enabled: true + type: http + port: 5000 + path: /api/health + startup: + enabled: true + type: http + port: 5000 + path: /api/health +{{- end -}} diff --git a/library/ix-dev/community/kavita/templates/_persistence.tpl b/library/ix-dev/community/kavita/templates/_persistence.tpl new file mode 100644 index 0000000000..76665d7fde --- /dev/null +++ b/library/ix-dev/community/kavita/templates/_persistence.tpl @@ -0,0 +1,24 @@ +{{- define "kavita.persistence" -}} +persistence: + config: + enabled: true + type: {{ .Values.kavitaStorage.config.type }} + datasetName: {{ .Values.kavitaStorage.config.datasetName | default "" }} + hostPath: {{ .Values.kavitaStorage.config.hostPath | default "" }} + targetSelector: + kavita: + kavita: + mountPath: /kavita/config + + {{- range $idx, $storage := .Values.kavitaStorage.additionalStorages }} + {{ printf "kavita-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + kavita: + kavita: + mountPath: {{ $storage.mountPath }} + {{- end }} +{{- end -}} diff --git a/library/ix-dev/community/kavita/templates/_portal.tpl b/library/ix-dev/community/kavita/templates/_portal.tpl new file mode 100644 index 0000000000..d23ac9de98 --- /dev/null +++ b/library/ix-dev/community/kavita/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "kavita.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.kavitaNetwork.webPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/kavita/templates/_service.tpl b/library/ix-dev/community/kavita/templates/_service.tpl new file mode 100644 index 0000000000..3dde3e97e6 --- /dev/null +++ b/library/ix-dev/community/kavita/templates/_service.tpl @@ -0,0 +1,16 @@ +{{- define "kavita.service" -}} +service: + kavita: + enabled: true + primary: true + type: NodePort + targetSelector: kavita + ports: + webui: + enabled: true + primary: true + port: {{ .Values.kavitaNetwork.webPort }} + nodePort: {{ .Values.kavitaNetwork.webPort }} + targetPort: 5000 + targetSelector: kavita +{{- end -}} diff --git a/library/ix-dev/community/kavita/templates/common.yaml b/library/ix-dev/community/kavita/templates/common.yaml new file mode 100644 index 0000000000..1f0e1bd550 --- /dev/null +++ b/library/ix-dev/community/kavita/templates/common.yaml @@ -0,0 +1,11 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "kavita.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "kavita.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "kavita.persistence" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "kavita.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/kavita/upgrade_info.json b/library/ix-dev/community/kavita/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/kavita/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/kavita/upgrade_strategy b/library/ix-dev/community/kavita/upgrade_strategy new file mode 100755 index 0000000000..af685230a1 --- /dev/null +++ b/library/ix-dev/community/kavita/upgrade_strategy @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import json +import re +import sys + +from catalog_update.upgrade_strategy import semantic_versioning + + +RE_STABLE_VERSION = re.compile(r'\d+\.\d+\.\d+') + + +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, + } + + +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))) diff --git a/library/ix-dev/community/kavita/values.yaml b/library/ix-dev/community/kavita/values.yaml new file mode 100644 index 0000000000..3575d92b35 --- /dev/null +++ b/library/ix-dev/community/kavita/values.yaml @@ -0,0 +1,21 @@ +image: + repository: kizaing/kavita + pullPolicy: IfNotPresent + tag: 0.7.8 + +resources: + limits: + cpu: 4000m + memory: 8Gi + +kavitaConfig: + additionalEnvs: [] + +kavitaNetwork: + webPort: 30069 + +kavitaStorage: + config: + type: ixVolume + datasetName: config + additionalStorages: []