NAS-124095 / 24.04 / add kapowarr to community train (#1537)

This commit is contained in:
Stavros Kois
2023-09-14 21:47:57 +03:00
committed by GitHub
parent 37b85cb9a4
commit 059f8dcbd1
19 changed files with 608 additions and 0 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,8 @@
runAsContext:
- userName: kapowarr
groupName: kapowarr
gid: 568
uid: 568
description: Kapowarr can run as any non-root user.
capabilities: []
hostMounts: []

View File

@@ -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.</br>
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.</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: "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.</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: "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.</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: "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.</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
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</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 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</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

View File

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

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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" . -}}

View File

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

View File

@@ -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)))

View File

@@ -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: []