diff --git a/library/ix-dev/community/kapowarr/Chart.lock b/library/ix-dev/community/kapowarr/Chart.lock new file mode 100644 index 0000000000..dd7fde934a --- /dev/null +++ b/library/ix-dev/community/kapowarr/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.1.1 +digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7 +generated: "2023-09-14T14:43:44.890615032+03:00" diff --git a/library/ix-dev/community/kapowarr/Chart.yaml b/library/ix-dev/community/kapowarr/Chart.yaml new file mode 100644 index 0000000000..823a3bfb0d --- /dev/null +++ b/library/ix-dev/community/kapowarr/Chart.yaml @@ -0,0 +1,26 @@ +name: kapowarr +description: Kapowarr is a software to build and manage a comic book library, fitting in the *arr suite of software. +annotations: + title: Kapowarr +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: 1.0.0 +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://casvt.github.io/Kapowarr/ +icon: https://raw.githubusercontent.com/Casvt/Kapowarr/48a42fe91dff66b2f7cac24bc9015f6d678dd942/docs/assets/img/favicon.svg +sources: + - https://hub.docker.com/r/mrcas/kapowarr + - https://github.com/truenas/charts/tree/master/library/ix-dev/community/kapowarr + - https://github.com/Casvt/Kapowarr +keywords: + - media + - comic diff --git a/library/ix-dev/community/kapowarr/README.md b/library/ix-dev/community/kapowarr/README.md new file mode 100644 index 0000000000..53a87e6d5d --- /dev/null +++ b/library/ix-dev/community/kapowarr/README.md @@ -0,0 +1,8 @@ +# Kapowarr + +[Kapowarr](https://casvt.github.io/Kapowarr/) is a software to build and manage a comic book library, fitting in the *arr suite of software. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Kapowarr` directories. +> Afterward, the `Kapowarr` container will run as a **non**-root user (Default: `568`). +> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user. diff --git a/library/ix-dev/community/kapowarr/app-readme.md b/library/ix-dev/community/kapowarr/app-readme.md new file mode 100644 index 0000000000..53a87e6d5d --- /dev/null +++ b/library/ix-dev/community/kapowarr/app-readme.md @@ -0,0 +1,8 @@ +# Kapowarr + +[Kapowarr](https://casvt.github.io/Kapowarr/) is a software to build and manage a comic book library, fitting in the *arr suite of software. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Kapowarr` directories. +> Afterward, the `Kapowarr` container will run as a **non**-root user (Default: `568`). +> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user. diff --git a/library/ix-dev/community/kapowarr/charts/common-1.1.1.tgz b/library/ix-dev/community/kapowarr/charts/common-1.1.1.tgz new file mode 100644 index 0000000000..a3ebb80ffc Binary files /dev/null and b/library/ix-dev/community/kapowarr/charts/common-1.1.1.tgz differ diff --git a/library/ix-dev/community/kapowarr/ci/basic-values.yaml b/library/ix-dev/community/kapowarr/ci/basic-values.yaml new file mode 100644 index 0000000000..9d7dbd3f7f --- /dev/null +++ b/library/ix-dev/community/kapowarr/ci/basic-values.yaml @@ -0,0 +1,17 @@ +kapowarrNetwork: + webPort: 31000 + +kapowarrRunAs: + user: 1000 + group: 1000 + +kapowarrStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/config + downloads: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/downloads + content: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/content diff --git a/library/ix-dev/community/kapowarr/ci/extra-values.yaml b/library/ix-dev/community/kapowarr/ci/extra-values.yaml new file mode 100644 index 0000000000..0858aa52c9 --- /dev/null +++ b/library/ix-dev/community/kapowarr/ci/extra-values.yaml @@ -0,0 +1,20 @@ +kapowarrNetwork: + webPort: 31000 + +kapowarrStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/config + downloads: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/downloads + content: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/content + additionalStorages: + - type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/data1 + mountPath: /data1 + - type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/data2 + mountPath: /data2 diff --git a/library/ix-dev/community/kapowarr/item.yaml b/library/ix-dev/community/kapowarr/item.yaml new file mode 100644 index 0000000000..2a04a13a85 --- /dev/null +++ b/library/ix-dev/community/kapowarr/item.yaml @@ -0,0 +1,8 @@ +icon_url: https://raw.githubusercontent.com/Casvt/Kapowarr/48a42fe91dff66b2f7cac24bc9015f6d678dd942/docs/assets/img/favicon.svg +categories: + - media +screenshots: + - https://user-images.githubusercontent.com/88994465/240648878-797a7f2d-b279-4e21-8b99-c03e99065949.png + - https://user-images.githubusercontent.com/88994465/240649307-71465b08-03eb-477e-a511-f5bc5d953447.png +tags: + - comic diff --git a/library/ix-dev/community/kapowarr/metadata.yaml b/library/ix-dev/community/kapowarr/metadata.yaml new file mode 100644 index 0000000000..ff7463f774 --- /dev/null +++ b/library/ix-dev/community/kapowarr/metadata.yaml @@ -0,0 +1,8 @@ +runAsContext: + - userName: kapowarr + groupName: kapowarr + gid: 568 + uid: 568 + description: Kapowarr can run as any non-root user. +capabilities: [] +hostMounts: [] diff --git a/library/ix-dev/community/kapowarr/questions.yaml b/library/ix-dev/community/kapowarr/questions.yaml new file mode 100644 index 0000000000..3cd090b01c --- /dev/null +++ b/library/ix-dev/community/kapowarr/questions.yaml @@ -0,0 +1,309 @@ +groups: + - name: Kapowarr Configuration + description: Configure Kapowarr + - name: User and Group Configuration + description: Configure User and Group for Kapowarr + - name: Network Configuration + description: Configure Network for Kapowarr + - name: Storage Configuration + description: Configure Storage for Kapowarr + - name: Resources Configuration + description: Configure Resources for Kapowarr + +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: kapowarrConfig + label: "" + group: Kapowarr Configuration + schema: + type: dict + attrs: + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Kapowarr. + 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: kapowarrRunAs + label: "" + group: User and Group Configuration + schema: + type: dict + attrs: + - variable: user + label: User ID + description: The user id that Kapowarr will run as. + schema: + type: int + min: 2 + default: 568 + required: true + - variable: group + label: Group ID + description: The group id that Kapowarr will run as. + schema: + type: int + min: 2 + default: 568 + required: true + + - variable: kapowarrNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: webPort + label: Web Port + description: The port for the Kapowarr Web UI. + schema: + type: int + default: 30071 + min: 9000 + max: 65535 + required: true + - variable: hostNetwork + label: Host Network + description: | + Bind to the host network. It's recommended to keep this disabled.
+ schema: + type: boolean + default: false + + - variable: kapowarrStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: config + label: Kapowarr Config Storage + description: The path to store Kapowarr 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: downloads + label: Kapowarr Download Storage + description: The path to store Kapowarr Downloads. + 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: "downloads" + $ref: + - "normalize/ixVolume" + - variable: hostPath + label: Host Path + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + immutable: true + required: true + - variable: content + label: Kapowarr Content Storage + description: The path to store Kapowarr Content. + 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: "content" + $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 Kapowarr. + 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 Kapowarr. + 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 Kapowarr. + 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/kapowarr/templates/NOTES.txt b/library/ix-dev/community/kapowarr/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/kapowarr/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/kapowarr/templates/_kapowarr.tpl b/library/ix-dev/community/kapowarr/templates/_kapowarr.tpl new file mode 100644 index 0000000000..e433b35c39 --- /dev/null +++ b/library/ix-dev/community/kapowarr/templates/_kapowarr.tpl @@ -0,0 +1,46 @@ +{{- define "kapowarr.workload" -}} +workload: + kapowarr: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: false + containers: + kapowarr: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: {{ .Values.kapowarrRunAs.user }} + runAsGroup: {{ .Values.kapowarrRunAs.group }} + {{ with .Values.kapowarrConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: http + port: 5656 + path: / + readiness: + enabled: true + type: http + port: 5656 + path: / + startup: + enabled: true + type: http + port: 5656 + path: / + initContainers: + {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions" + "UID" .Values.kapowarrRunAs.user + "GID" .Values.kapowarrRunAs.group + "mode" "check" + "type" "init") | nindent 8 }} +{{- end -}} diff --git a/library/ix-dev/community/kapowarr/templates/_persistence.tpl b/library/ix-dev/community/kapowarr/templates/_persistence.tpl new file mode 100644 index 0000000000..42ae3b4c39 --- /dev/null +++ b/library/ix-dev/community/kapowarr/templates/_persistence.tpl @@ -0,0 +1,49 @@ +{{- define "kapowarr.persistence" -}} +persistence: + config: + enabled: true + type: {{ .Values.kapowarrStorage.config.type }} + datasetName: {{ .Values.kapowarrStorage.config.datasetName | default "" }} + hostPath: {{ .Values.kapowarrStorage.config.hostPath | default "" }} + targetSelector: + kapowarr: + kapowarr: + mountPath: /app/db + 01-permissions: + mountPath: /mnt/directories/config + downloads: + enabled: true + type: {{ .Values.kapowarrStorage.downloads.type }} + datasetName: {{ .Values.kapowarrStorage.downloads.datasetName | default "" }} + hostPath: {{ .Values.kapowarrStorage.downloads.hostPath | default "" }} + targetSelector: + kapowarr: + kapowarr: + mountPath: /app/temp_downloads + 01-permissions: + mountPath: /mnt/directories/downloads + content: + enabled: true + type: {{ .Values.kapowarrStorage.content.type }} + datasetName: {{ .Values.kapowarrStorage.content.datasetName | default "" }} + hostPath: {{ .Values.kapowarrStorage.content.hostPath | default "" }} + targetSelector: + kapowarr: + kapowarr: + mountPath: /content + 01-permissions: + mountPath: /mnt/directories/content + {{- range $idx, $storage := .Values.kapowarrStorage.additionalStorages }} + {{ printf "kapowarr-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + kapowarr: + kapowarr: + mountPath: {{ $storage.mountPath }} + 01-permissions: + mountPath: /mnt/directories{{ $storage.mountPath }} + {{- end }} +{{- end -}} diff --git a/library/ix-dev/community/kapowarr/templates/_portal.tpl b/library/ix-dev/community/kapowarr/templates/_portal.tpl new file mode 100644 index 0000000000..e1ef144c7b --- /dev/null +++ b/library/ix-dev/community/kapowarr/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "kapowarr.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.kapowarrNetwork.webPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/kapowarr/templates/_service.tpl b/library/ix-dev/community/kapowarr/templates/_service.tpl new file mode 100644 index 0000000000..5987d9301d --- /dev/null +++ b/library/ix-dev/community/kapowarr/templates/_service.tpl @@ -0,0 +1,16 @@ +{{- define "kapowarr.service" -}} +service: + kapowarr: + enabled: true + primary: true + type: NodePort + targetSelector: kapowarr + ports: + webui: + enabled: true + primary: true + port: {{ .Values.kapowarrNetwork.webPort }} + nodePort: {{ .Values.kapowarrNetwork.webPort }} + targetPort: 5656 + targetSelector: kapowarr +{{- end -}} diff --git a/library/ix-dev/community/kapowarr/templates/common.yaml b/library/ix-dev/community/kapowarr/templates/common.yaml new file mode 100644 index 0000000000..280b094cd6 --- /dev/null +++ b/library/ix-dev/community/kapowarr/templates/common.yaml @@ -0,0 +1,11 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "kapowarr.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "kapowarr.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "kapowarr.persistence" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "kapowarr.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/kapowarr/upgrade_info.json b/library/ix-dev/community/kapowarr/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/kapowarr/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/kapowarr/upgrade_strategy b/library/ix-dev/community/kapowarr/upgrade_strategy new file mode 100755 index 0000000000..7778ae42bd --- /dev/null +++ b/library/ix-dev/community/kapowarr/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'v\d+\.\d+\.\d+(-beta-\d+)?') + + +def newer_mapping(image_tags): + key = list(image_tags.keys())[0] + tags = {t.strip('v').split('-')[0]: 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/kapowarr/values.yaml b/library/ix-dev/community/kapowarr/values.yaml new file mode 100644 index 0000000000..5d2bc056db --- /dev/null +++ b/library/ix-dev/community/kapowarr/values.yaml @@ -0,0 +1,31 @@ +image: + repository: mrcas/kapowarr + pullPolicy: IfNotPresent + tag: v1.0.0-beta-3 + +resources: + limits: + cpu: 4000m + memory: 8Gi + +kapowarrConfig: + additionalEnvs: [] + +kapowarrNetwork: + webPort: 30071 + +kapowarrRunAs: + user: 568 + group: 568 + +kapowarrStorage: + config: + type: ixVolume + datasetName: config + downloads: + type: ixVolume + datasetName: downloads + content: + type: ixVolume + datasetName: content + additionalStorages: []