diff --git a/library/ix-dev/community/deluge/Chart.lock b/library/ix-dev/community/deluge/Chart.lock new file mode 100644 index 0000000000..2b3785e803 --- /dev/null +++ b/library/ix-dev/community/deluge/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.0.8 +digest: sha256:254efaa1285f634b7a80b7baadeadbd20a680f7fee49d1d9d3c4618aa0d657ad +generated: "2023-06-13T16:21:59.289590931+03:00" diff --git a/library/ix-dev/community/deluge/Chart.yaml b/library/ix-dev/community/deluge/Chart.yaml new file mode 100644 index 0000000000..0c56c8a085 --- /dev/null +++ b/library/ix-dev/community/deluge/Chart.yaml @@ -0,0 +1,26 @@ +name: deluge +description: Deluge is a lightweight, Free Software, cross-platform BitTorrent client. +annotations: + title: Deluge +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: '9.5.3' +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.0.8 +home: https://deluge-torrent.org +icon: https://deluge-torrent.org/images/deluge_logo.png +sources: + - https://hub.docker.com/r/linuxserver/deluge + - https://github.com/truenas/charts/tree/master/community/deluge + - https://deluge-torrent.org/ +keywords: + - torrent + - download diff --git a/library/ix-dev/community/deluge/README.md b/library/ix-dev/community/deluge/README.md new file mode 100644 index 0000000000..5774997b15 --- /dev/null +++ b/library/ix-dev/community/deluge/README.md @@ -0,0 +1,3 @@ +# Deluge + +[Deluge](https://deluge-torrent.org/) is a lightweight, Free Software, cross-platform BitTorrent client. diff --git a/library/ix-dev/community/deluge/app-readme.md b/library/ix-dev/community/deluge/app-readme.md new file mode 100644 index 0000000000..5774997b15 --- /dev/null +++ b/library/ix-dev/community/deluge/app-readme.md @@ -0,0 +1,3 @@ +# Deluge + +[Deluge](https://deluge-torrent.org/) is a lightweight, Free Software, cross-platform BitTorrent client. diff --git a/library/ix-dev/community/deluge/charts/common-1.0.8.tgz b/library/ix-dev/community/deluge/charts/common-1.0.8.tgz new file mode 100644 index 0000000000..63acf6504f Binary files /dev/null and b/library/ix-dev/community/deluge/charts/common-1.0.8.tgz differ diff --git a/library/ix-dev/community/deluge/ci/basic-values.yaml b/library/ix-dev/community/deluge/ci/basic-values.yaml new file mode 100644 index 0000000000..43924ebd3b --- /dev/null +++ b/library/ix-dev/community/deluge/ci/basic-values.yaml @@ -0,0 +1,7 @@ +delugeStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/config + downloads: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/downloads diff --git a/library/ix-dev/community/deluge/ci/hostnet-values.yaml b/library/ix-dev/community/deluge/ci/hostnet-values.yaml new file mode 100644 index 0000000000..55823748a0 --- /dev/null +++ b/library/ix-dev/community/deluge/ci/hostnet-values.yaml @@ -0,0 +1,10 @@ +delugeStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/config + downloads: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/downloads + +delugeNetwork: + hostNetwork: true diff --git a/library/ix-dev/community/deluge/item.yaml b/library/ix-dev/community/deluge/item.yaml new file mode 100644 index 0000000000..532e43d54c --- /dev/null +++ b/library/ix-dev/community/deluge/item.yaml @@ -0,0 +1,7 @@ +icon_url: https://deluge-torrent.org/images/deluge_logo.png +categories: + - media +screenshots: [] +tags: + - torrent + - download diff --git a/library/ix-dev/community/deluge/metadata.yaml b/library/ix-dev/community/deluge/metadata.yaml new file mode 100644 index 0000000000..d874017d61 --- /dev/null +++ b/library/ix-dev/community/deluge/metadata.yaml @@ -0,0 +1,18 @@ +runAsContext: + - userName: root + groupName: root + gid: 0 + uid: 0 + description: Deluge requires root privileges to start the Deluge process +capabilities: + - name: CHOWN + description: Deluge is able to chown files. + - name: DAC_OVERRIDE + description: Deluge is able to bypass permission checks. + - name: FOWNER + description: Deluge is able bypass permission checks for it's sub-processes. + - name: SETGID + description: Deluge is able to set group ID for it's sub-processes. + - name: SETUID + description: Deluge is able to set user ID for it's sub-processes. +hostMounts: [] diff --git a/library/ix-dev/community/deluge/questions.yaml b/library/ix-dev/community/deluge/questions.yaml new file mode 100644 index 0000000000..36dd5f2f61 --- /dev/null +++ b/library/ix-dev/community/deluge/questions.yaml @@ -0,0 +1,280 @@ +groups: + - name: Deluge Configuration + description: Configure Deluge + - name: User and Group Configuration + description: Configure User and Group for Deluge + - name: Network Configuration + description: Configure Network for Deluge + - name: Storage Configuration + description: Configure Storage for Deluge + - name: Resources Configuration + description: Configure Resources for Deluge + +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: Deluge Configuration + label: Timezone + schema: + type: string + default: Etc/UTC + required: true + $ref: + - definitions/timezone + + - variable: delugeConfig + label: "" + group: Deluge Configuration + schema: + type: dict + attrs: + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Deluge. + 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: delugeID + label: "" + group: User and Group Configuration + schema: + type: dict + attrs: + - variable: user + label: User ID + description: he user id that Deluge files will be owned by. + schema: + type: int + min: 2 + default: 568 + required: true + - variable: group + label: Group ID + description: The group id that Deluge files will be owned by. + schema: + type: int + min: 2 + default: 568 + required: true + + - variable: delugeNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: hostNetwork + label: Host Network + description: | + Bind to the host network. It's recommended to keep this disabled.
+ schema: + type: boolean + default: false + - variable: webPort + label: Web Port + description: The port for the Deluge Web UI. + schema: + type: int + show_if: [["hostNetwork", "=", false]] + default: 30038 + min: 9000 + max: 65535 + required: true + - variable: torrentPort + label: Torrent Port + description: | + The port for the Deluge Torrent.
+ Applies to both TCP and UDP. + (Internal port is always 6881) + schema: + type: int + show_if: [["hostNetwork", "=", false]] + default: 30039 + min: 9000 + max: 65535 + required: true + + - variable: delugeStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: config + label: Deluge Config Storage + description: The path to store Deluge 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: Deluge Downloads Storage + description: The path to store Deluge 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: additionalStorages + label: Additional Storage + description: Additional storage for Deluge. + 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 Deluge. + schema: + type: string + default: "4000m" + required: true + - variable: memory + label: Memory + description: Memory limit for Deluge. + schema: + type: string + default: "8Gi" + required: true diff --git a/library/ix-dev/community/deluge/templates/NOTES.txt b/library/ix-dev/community/deluge/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/deluge/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/deluge/templates/_deluge.tpl b/library/ix-dev/community/deluge/templates/_deluge.tpl new file mode 100644 index 0000000000..b0d310cfd1 --- /dev/null +++ b/library/ix-dev/community/deluge/templates/_deluge.tpl @@ -0,0 +1,118 @@ +{{- define "deluge.workload" -}} +workload: + deluge: + enabled: true + primary: true + type: Deployment + podSpec: + securityContext: + fsGroup: {{ .Values.delugeID.group }} + hostNetwork: {{ .Values.delugeNetwork.hostNetwork }} + containers: + deluge: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false + readOnlyRootFilesystem: false + capabilities: + add: + - CHOWN + - DAC_OVERRIDE + - FOWNER + - SETGID + - SETUID + {{ with .Values.delugeConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: http + port: 8112 + path: / + readiness: + enabled: true + type: http + port: 8112 + path: / + startup: + enabled: true + type: http + port: 8112 + path: / + +{{/* Service */}} +service: + deluge: + enabled: true + primary: true + type: NodePort + targetSelector: deluge + ports: + webui: + enabled: true + primary: true + port: {{ .Values.delugeNetwork.webPort }} + nodePort: {{ .Values.delugeNetwork.webPort }} + targetPort: 8112 + targetSelector: deluge + torrent: + enabled: true + type: NodePort + targetSelector: deluge + ports: + tcp: + enabled: true + primary: true + port: {{ .Values.delugeNetwork.torrentPort }} + nodePort: {{ .Values.delugeNetwork.torrentPort }} + targetPort: 6881 + targetSelector: deluge + udp: + enabled: true + port: {{ .Values.delugeNetwork.torrentPort }} + nodePort: {{ .Values.delugeNetwork.torrentPort }} + targetPort: 6881 + protocol: udp + targetSelector: deluge + +{{/* Persistence */}} +persistence: + config: + enabled: true + type: {{ .Values.delugeStorage.config.type }} + datasetName: {{ .Values.delugeStorage.config.datasetName | default "" }} + hostPath: {{ .Values.delugeStorage.config.hostPath | default "" }} + targetSelector: + deluge: + deluge: + mountPath: /config + downloads: + enabled: true + type: {{ .Values.delugeStorage.downloads.type }} + datasetName: {{ .Values.delugeStorage.downloads.datasetName | default "" }} + hostPath: {{ .Values.delugeStorage.downloads.hostPath | default "" }} + targetSelector: + deluge: + deluge: + mountPath: /downloads + {{- range $idx, $storage := .Values.delugeStorage.additionalStorages }} + {{ printf "deluge-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + deluge: + deluge: + mountPath: {{ $storage.mountPath }} + {{- end }} +{{- end -}} diff --git a/library/ix-dev/community/deluge/templates/_portal.tpl b/library/ix-dev/community/deluge/templates/_portal.tpl new file mode 100644 index 0000000000..a5ab633f3f --- /dev/null +++ b/library/ix-dev/community/deluge/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "deluge.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.delugeNetwork.webPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/deluge/templates/common.yaml b/library/ix-dev/community/deluge/templates/common.yaml new file mode 100644 index 0000000000..0596641f18 --- /dev/null +++ b/library/ix-dev/community/deluge/templates/common.yaml @@ -0,0 +1,9 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "deluge.workload" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "deluge.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/deluge/upgrade_info.json b/library/ix-dev/community/deluge/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/deluge/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/deluge/upgrade_strategy b/library/ix-dev/community/deluge/upgrade_strategy new file mode 100755 index 0000000000..41e9448b21 --- /dev/null +++ b/library/ix-dev/community/deluge/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'[0-9]+\.[0-9]+\.[0-9]+') + + +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/deluge/values.yaml b/library/ix-dev/community/deluge/values.yaml new file mode 100644 index 0000000000..6835c6ea15 --- /dev/null +++ b/library/ix-dev/community/deluge/values.yaml @@ -0,0 +1,36 @@ +image: + repository: linuxserver/deluge + pullPolicy: IfNotPresent + tag: '2.1.1' + +resources: + limits: + cpu: 4000m + memory: 8Gi + +delugeConfig: + additionalEnvs: [] + +delugeNetwork: + hostNetwork: false + webPort: 30038 + torrentPort: 30039 + +delugeID: + user: 568 + group: 568 + +delugeStorage: + config: + type: ixVolume + datasetName: config + downloads: + type: ixVolume + datasetName: downloads + additionalStorages: [] + +notes: + custom: | + Default credentials: + - Username: admin + - Password: deluge