diff --git a/library/ix-dev/charts/radarr/Chart.lock b/library/ix-dev/charts/radarr/Chart.lock new file mode 100644 index 0000000000..e9f55bee40 --- /dev/null +++ b/library/ix-dev/charts/radarr/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.0.3 +digest: sha256:1a090020cfa582aff29906320874ffe9b543fcc6c2423c281f434514f2653e02 +generated: "2023-04-07T14:31:28.408246409+03:00" diff --git a/library/ix-dev/charts/radarr/Chart.yaml b/library/ix-dev/charts/radarr/Chart.yaml new file mode 100644 index 0000000000..e7b668de02 --- /dev/null +++ b/library/ix-dev/charts/radarr/Chart.yaml @@ -0,0 +1,25 @@ +name: radarr +description: Radarr is a movie collection manager for Usenet and BitTorrent users. +annotations: + title: Radarr +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: '4.3.2.6857' +kubeVersion: '>=1.16.0-0' +maintainers: + - name: truenas + url: https://www.truenas.com/ +dependencies: + - name: common + repository: file://../../../common + version: 1.0.3 +home: https://github.com/Radarr/Radarr +icon: https://raw.githubusercontent.com/Radarr/Radarr/develop/Logo/256.png +sources: + - https://github.com/onedr0p/containers/tree/main/apps/radarr + - https://github.com/truenas/charts/tree/master/charts/radarr + - https://github.com/Radarr/Radarr +keywords: + - media + - movies diff --git a/library/ix-dev/charts/radarr/README.md b/library/ix-dev/charts/radarr/README.md new file mode 100644 index 0000000000..e447cfd769 --- /dev/null +++ b/library/ix-dev/charts/radarr/README.md @@ -0,0 +1,8 @@ +# Radarr + +[Radarr](https://github.com/Radarr/Radarr) is a movie collection manager for Usenet and BitTorrent users. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Radarr` directories. +> Afterward, the `Radarr` 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/charts/radarr/app-readme.md b/library/ix-dev/charts/radarr/app-readme.md new file mode 100644 index 0000000000..e447cfd769 --- /dev/null +++ b/library/ix-dev/charts/radarr/app-readme.md @@ -0,0 +1,8 @@ +# Radarr + +[Radarr](https://github.com/Radarr/Radarr) is a movie collection manager for Usenet and BitTorrent users. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Radarr` directories. +> Afterward, the `Radarr` 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/charts/radarr/charts/common-1.0.3.tgz b/library/ix-dev/charts/radarr/charts/common-1.0.3.tgz new file mode 100644 index 0000000000..624e70f9dc Binary files /dev/null and b/library/ix-dev/charts/radarr/charts/common-1.0.3.tgz differ diff --git a/library/ix-dev/charts/radarr/ci/basic-values.yaml b/library/ix-dev/charts/radarr/ci/basic-values.yaml new file mode 100644 index 0000000000..9bd5559cf9 --- /dev/null +++ b/library/ix-dev/charts/radarr/ci/basic-values.yaml @@ -0,0 +1,11 @@ +radarrNetwork: + webPort: 31000 + +radarrRunAs: + user: 1000 + group: 1000 + +radarrStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/config diff --git a/library/ix-dev/charts/radarr/ci/extra-values.yaml b/library/ix-dev/charts/radarr/ci/extra-values.yaml new file mode 100644 index 0000000000..7c71264f61 --- /dev/null +++ b/library/ix-dev/charts/radarr/ci/extra-values.yaml @@ -0,0 +1,21 @@ +radarrConfig: + additionalEnvs: + - name: RADARR__AUTHENTICATION_METHOD + value: some-long-api-key + - name: RADARR__LOG_LEVEL + value: error + +radarrNetwork: + webPort: 31000 + +radarrStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/config + additionalStorages: + - type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/action_movies + mountPath: /action_movies + - type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/adventure_movies + mountPath: /adventure_movies diff --git a/library/ix-dev/charts/radarr/ci/hostNet-values.yaml b/library/ix-dev/charts/radarr/ci/hostNet-values.yaml new file mode 100644 index 0000000000..00fa637ddb --- /dev/null +++ b/library/ix-dev/charts/radarr/ci/hostNet-values.yaml @@ -0,0 +1,8 @@ +radarrNetwork: + webPort: 30000 + hostNetwork: true + +radarrStorage: + config: + type: hostPath + hostPath: /mnt/{{ .Release.Namespace }}/config diff --git a/library/ix-dev/charts/radarr/item.yaml b/library/ix-dev/charts/radarr/item.yaml new file mode 100644 index 0000000000..78aa03c600 --- /dev/null +++ b/library/ix-dev/charts/radarr/item.yaml @@ -0,0 +1,4 @@ +icon_url: https://raw.githubusercontent.com/Radarr/Radarr/develop/Logo/256.png +categories: + - media + - movies diff --git a/library/ix-dev/charts/radarr/questions.yaml b/library/ix-dev/charts/radarr/questions.yaml new file mode 100644 index 0000000000..05b278b21b --- /dev/null +++ b/library/ix-dev/charts/radarr/questions.yaml @@ -0,0 +1,225 @@ +groups: + - name: Radarr Configuration + description: Configure Radarr + - name: User and Group Configuration + description: Configure User and Group for Radarr + - name: Network Configuration + description: Configure Network for Radarr + - name: Storage Configuration + description: Configure Storage for Radarr + - name: Resources Configuration + description: Configure Resources for Radarr + +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: radarrConfig + label: "" + group: Radarr Configuration + schema: + type: dict + attrs: + - variable: instanceName + label: Instance Name + description: The name of the Radarr instance. + schema: + type: string + default: Radarr + required: true + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Radarr. + 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: radarrRunAs + label: "" + group: User and Group Configuration + schema: + type: dict + attrs: + - variable: user + label: User ID + description: The user id that Radarr will run as. + schema: + type: int + min: 1 + default: 568 + required: true + - variable: group + label: Group ID + description: The group id that Radarr will run as. + schema: + type: int + min: 1 + default: 568 + required: true + + - variable: radarrNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: webPort + label: Web Port + description: The port for the Radarr Web UI. + schema: + type: int + default: 30000 + 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: radarrStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: config + label: Radarr Config Storage + description: The path to store Radarr 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 Radarr. + 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 Radarr. + schema: + type: string + default: 4000m + required: true + - variable: memory + label: Memory + description: Memory limit for Radarr. + schema: + type: string + default: 8Gi + required: true diff --git a/library/ix-dev/charts/radarr/templates/NOTES.txt b/library/ix-dev/charts/radarr/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/charts/radarr/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/charts/radarr/templates/_portal.tpl b/library/ix-dev/charts/radarr/templates/_portal.tpl new file mode 100644 index 0000000000..9e841214e9 --- /dev/null +++ b/library/ix-dev/charts/radarr/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "radarr.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.radarrNetwork.webPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/charts/radarr/templates/_radarr.tpl b/library/ix-dev/charts/radarr/templates/_radarr.tpl new file mode 100644 index 0000000000..e1809d6c9e --- /dev/null +++ b/library/ix-dev/charts/radarr/templates/_radarr.tpl @@ -0,0 +1,101 @@ +{{- define "radarr.workload" -}} +workload: + radarr: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: {{ .Values.radarrNetwork.hostNetwork }} + containers: + radarr: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: {{ .Values.radarrRunAs.user }} + runAsGroup: {{ .Values.radarrRunAs.group }} + {{ with .Values.radarrConfig.additionalEnvs }} + env: + {{ range $env := . }} + {{ $env.name }}: {{ $env.value }} + {{ end }} + {{ end }} + env: + RADARR__PORT: {{ .Values.radarrNetwork.webPort }} + RADARR__INSTANCE_NAME: {{ .Values.radarrConfig.instanceName }} + probes: + liveness: + enabled: true + type: http + port: "{{ .Values.radarrNetwork.webPort }}" + path: / + # FIXME: Next release will include this endpoint without auth + # path: /ping + readiness: + enabled: true + type: http + port: "{{ .Values.radarrNetwork.webPort }}" + path: / + # path: /ping + startup: + enabled: true + type: http + port: "{{ .Values.radarrNetwork.webPort }}" + path: / + # path: /ping + initContainers: + {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions" + "UID" .Values.radarrRunAs.user + "GID" .Values.radarrRunAs.group + "mode" "check" + "type" "init") | nindent 8 }} + +{{/* Service */}} +service: + radarr: + enabled: true + primary: true + type: NodePort + targetSelector: radarr + ports: + webui: + enabled: true + primary: true + port: {{ .Values.radarrNetwork.webPort }} + nodePort: {{ .Values.radarrNetwork.webPort }} + targetSelector: radarr + +{{/* Persistence */}} +persistence: + config: + enabled: true + type: {{ .Values.radarrStorage.config.type }} + datasetName: {{ .Values.radarrStorage.config.datasetName | default "" }} + hostPath: {{ .Values.radarrStorage.config.hostPath | default "" }} + targetSelector: + radarr: + radarr: + mountPath: /config + 01-permissions: + mountPath: /mnt/directories/config + tmp: + enabled: true + type: emptyDir + targetSelector: + radarr: + radarr: + mountPath: /tmp + {{- range $idx, $storage := .Values.radarrStorage.additionalStorages }} + {{ printf "radarr-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + radarr: + radarr: + mountPath: {{ $storage.mountPath }} + 01-permissions: + mountPath: /mnt/directories{{ $storage.mountPath }} + {{- end }} +{{- end -}} diff --git a/library/ix-dev/charts/radarr/templates/common.yaml b/library/ix-dev/charts/radarr/templates/common.yaml new file mode 100644 index 0000000000..3edc25d005 --- /dev/null +++ b/library/ix-dev/charts/radarr/templates/common.yaml @@ -0,0 +1,9 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "radarr.workload" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "radarr.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/charts/radarr/upgrade_info.json b/library/ix-dev/charts/radarr/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/charts/radarr/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/charts/radarr/upgrade_strategy b/library/ix-dev/charts/radarr/upgrade_strategy new file mode 100755 index 0000000000..3e49862388 --- /dev/null +++ b/library/ix-dev/charts/radarr/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]+\.[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/charts/radarr/values.yaml b/library/ix-dev/charts/radarr/values.yaml new file mode 100644 index 0000000000..49e3b55d57 --- /dev/null +++ b/library/ix-dev/charts/radarr/values.yaml @@ -0,0 +1,25 @@ +image: + repository: ghcr.io/onedr0p/radarr + pullPolicy: IfNotPresent + tag: '4.3.2.6857' + +resources: + limits: + cpu: 4000m + memory: 8Gi + +radarrConfig: + instanceName: Radarr + additionalEnvs: [] +radarrNetwork: + webPort: 30000 + hostNetwork: false +radarrRunAs: + user: 568 + group: 568 +radarrStorage: + config: + type: ixVolume + hostPath: '' + datasetName: config + additionalStorages: []