adds 2 community apps for testing (smb-pv-pvc) (#1558)

* make copies to test

* adds 2 community apps for testing (smb-pv-pvc)
This commit is contained in:
Stavros Kois
2023-09-22 13:44:59 +03:00
committed by GitHub
parent dbf2777c03
commit e8e998f81e
38 changed files with 1405 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-21T15:59:06.600933007+03:00"

View File

@@ -0,0 +1,26 @@
name: jellyfin
description: Jellyfin is a Free Software Media System that puts you in control of managing and streaming your media.
annotations:
title: Jellyfin
type: application
version: 1.0.13
apiVersion: v2
appVersion: '10.8.10'
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://jellyfin.org/
icon: https://jellyfin.org/images/logo.svg
sources:
- https://hub.docker.com/r/jellyfin/jellyfin
- https://github.com/truenas/charts/tree/master/community/jellyfin
- https://jellyfin.org/
keywords:
- media
- streaming

View File

@@ -0,0 +1,8 @@
# Jellyfin
[Jellyfin](https://jellyfin.org/) is a Free Software Media System that puts you in control of managing and streaming your media.
> When application is installed, a container will be launched with **root** privileges.
> This is required in order to apply the correct permissions to the `Jellyfin` directories.
> Afterward, the `Jellyfin` 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 @@
# Jellyfin
[Jellyfin](https://jellyfin.org/) is a Free Software Media System that puts you in control of managing and streaming your media.
> When application is installed, a container will be launched with **root** privileges.
> This is required in order to apply the correct permissions to the `Jellyfin` directories.
> Afterward, the `Jellyfin` 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.

Binary file not shown.

View File

@@ -0,0 +1,24 @@
jellyfinNetwork:
webPort: 31000
jellyfinRunAs:
user: 1000
group: 1000
jellyfinStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config
cache:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/cache
transcodes:
type: emptyDir
medium: Memory
size: 1Gi
# Make sure installation don't fail when 0 GPU are assigned
jellyfinGPU:
nvidia.com/gpu: 0
intel.com/gpu: 0
# TODO: Test assigning GPUs on a GPU-enabled system

View File

@@ -0,0 +1,22 @@
jellyfinNetwork:
webPort: 31000
jellyfinStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config
cache:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/cache
transcodes:
type: emptyDir
medium: ''
size: ''
additionalStorages:
- type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/movies
mountPath: /movies
- type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/series
mountPath: /series

View File

@@ -0,0 +1,13 @@
jellyfinNetwork:
hostNetwork: true
jellyfinStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config
cache:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/cache
transcodes:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/transcodes

View File

@@ -0,0 +1,12 @@
icon_url: https://jellyfin.org/images/logo.svg
categories:
- media
screenshots:
- https://jellyfin.org/assets/images/10.8-home-4a73a92bf90d1eeffa5081201ca9c7bb.png
- https://jellyfin.org/assets/images/10.8-details-df4f7caaee389ffbaeeaa95b668fa037.png
tags:
- entertainment
- movies
- series
- tv
- streaming

View File

@@ -0,0 +1,8 @@
runAsContext:
- userName: jellyfin
groupName: jellyfin
gid: 568
uid: 568
description: Jellyfin runs as any non-root user.
capabilities: []
hostMounts: []

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
storageKey = 'jellyfinStorage'
storages = ['config', 'cache', 'transcodes']
for storage in storages:
check_val = values.get(storageKey, {}).get(storage, {})
if not isinstance(check_val, dict) or not check_val or check_val.get('type', 'hostPath') == 'hostPath':
continue
values[storageKey][storage] = {key: value for key, value in check_val.items() if key != 'hostPath'}
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))

View File

@@ -0,0 +1,398 @@
groups:
- name: Jellyfin Configuration
description: Configure Jellyfin
- name: User and Group Configuration
description: Configure User and Group for Jellyfin
- name: Network Configuration
description: Configure Network for Jellyfin
- name: Storage Configuration
description: Configure Storage for Jellyfin
- name: Resources Configuration
description: Configure Resources for Jellyfin
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: jellyfinConfig
label: ""
group: Jellyfin Configuration
schema:
type: dict
attrs:
- variable: publishServerUrl
label: Published Server URL
description: Optional - The URL that Jellyfin will be advertised.
schema:
type: string
default: ""
- variable: additionalEnvs
label: Additional Environment Variables
description: Configure additional environment variables for Jellyfin.
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: jellyfinRunAs
label: ""
group: User and Group Configuration
schema:
type: dict
attrs:
- variable: user
label: User ID
description: The user id that Jellyfin will run as.
schema:
type: int
min: 2
default: 568
required: true
- variable: group
label: Group ID
description: The group id that Jellyfin will run as.
schema:
type: int
min: 2
default: 568
required: true
- variable: jellyfinNetwork
label: ""
group: Network Configuration
schema:
type: dict
attrs:
- variable: hostNetwork
label: Host Network
description: |
Bind to the host network. While it's recommended to keep this disabled.</br>
It's required for autodiscovery to work.
schema:
type: boolean
default: false
- variable: webPort
label: Web Port
description: The port for the Jellyfin Web UI.
schema:
type: int
default: 30013
show_if: [["hostNetwork", "=", false]]
min: 9000
max: 65535
required: true
- variable: jellyfinStorage
label: ""
group: Storage Configuration
schema:
type: dict
attrs:
- variable: config
label: Jellyfin Config Storage
description: The path to store Jellyfin 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: cache
label: Jellyfin Cache Storage
description: The path to store Jellyfin Cache.
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: "cache"
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: transcodes
label: Jellyfin Transcodes Storage
description: The path to store Jellyfin Transcodes.
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.</br>
emptyDir: Is a temporary directory that will be created on the disk or in memory.
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)
- value: "emptyDir"
description: emptyDir (Temporary directory created on the disk or in memory)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: "transcodes"
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: medium
label: emptyDir Medium
description: |
Disk: Creates a temporary directory on the disk.</br>
Memory: Creates a temporary directory in memory.
schema:
type: string
show_if: [["type", "=", "emptyDir"]]
default: ""
enum:
- value: ""
description: Disk (Temporary directory created on the disk)
- value: "Memory"
description: Memory (Temporary directory created in memory)
- variable: size
label: emptyDir Size Limit
description: |
The maximum size of the temporary directory.</br>
For example: 2Gi
schema:
type: string
show_if: [["type", "=", "emptyDir"]]
default: "2Gi"
- variable: additionalStorages
label: Additional Storage
description: Additional storage for Jellyfin.
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)
- value: "smb-pv-pvc"
description: SMB Share (Mounts a persistent volume claim to a SMB share)
- 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: server
label: Server
description: The server for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
- variable: share
label: Share
description: The share name for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
- variable: domain
label: Domain (Optional)
description: The domain for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
- variable: username
label: Username
description: The username for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
- variable: password
label: Password
description: The password for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
private: true
- variable: size
label: Size (in Gi)
description: The size of the volume quota.
schema:
type: int
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
min: 1
default: 1
- 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 Jellyfin.
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 Jellyfin.
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
- variable: jellyfinGPU
group: Resources Configuration
label: GPU Configuration
schema:
type: dict
$ref:
- "definitions/gpuConfiguration"
attrs: []

View File

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

View File

@@ -0,0 +1,151 @@
{{- define "jellyfin.workload" -}}
workload:
jellyfin:
enabled: true
primary: true
type: Deployment
podSpec:
hostNetwork: {{ .Values.jellyfinNetwork.hostNetwork }}
containers:
jellyfin:
enabled: true
primary: true
imageSelector: image
securityContext:
runAsUser: {{ .Values.jellyfinRunAs.user }}
runAsGroup: {{ .Values.jellyfinRunAs.group }}
env:
{{ with .Values.jellyfinConfig.publishedServerUrl }}
JELLYFIN_PublishedServerUrl: {{ . | quote }}
{{ end }}
{{ with .Values.jellyfinConfig.additionalEnvs }}
envList:
{{ range $env := . }}
- name: {{ $env.name }}
values: {{ $env.value }}
{{ end }}
{{ end }}
probes:
liveness:
enabled: true
type: http
port: 8096
path: /health
readiness:
enabled: true
type: http
port: 8096
path: /health
startup:
enabled: true
type: http
port: 8096
path: /health
initContainers:
{{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
"UID" .Values.jellyfinRunAs.user
"GID" .Values.jellyfinRunAs.group
"mode" "check"
"type" "init") | nindent 8 }}
{{/* Service */}}
service:
jellyfin:
enabled: true
primary: true
type: NodePort
targetSelector: jellyfin
ports:
webui:
enabled: true
primary: true
port: {{ .Values.jellyfinNetwork.webPort }}
nodePort: {{ .Values.jellyfinNetwork.webPort }}
targetPort: 8096
targetSelector: jellyfin
{{/* Persistence */}}
persistence:
config:
enabled: true
type: {{ .Values.jellyfinStorage.config.type }}
datasetName: {{ .Values.jellyfinStorage.config.datasetName | default "" }}
hostPath: {{ .Values.jellyfinStorage.config.hostPath | default "" }}
targetSelector:
jellyfin:
jellyfin:
mountPath: /config
01-permissions:
mountPath: /mnt/directories/config
cache:
enabled: true
type: {{ .Values.jellyfinStorage.cache.type }}
datasetName: {{ .Values.jellyfinStorage.cache.datasetName | default "" }}
hostPath: {{ .Values.jellyfinStorage.cache.hostPath | default "" }}
targetSelector:
jellyfin:
jellyfin:
mountPath: /cache
01-permissions:
mountPath: /mnt/directories/cache
transcode:
enabled: true
type: {{ .Values.jellyfinStorage.transcodes.type }}
datasetName: {{ .Values.jellyfinStorage.transcodes.datasetName | default "" }}
hostPath: {{ .Values.jellyfinStorage.transcodes.hostPath | default "" }}
medium: {{ .Values.jellyfinStorage.transcodes.medium | default "" }}
{{/* Size of the emptyDir */}}
size: {{ .Values.jellyfinStorage.transcodes.size | default "" }}
targetSelector:
jellyfin:
jellyfin:
mountPath: /config/transcodes
{{ if ne .Values.jellyfinStorage.transcodes.type "emptyDir" }}
01-permissions:
mountPath: /mnt/directories/transcodes
{{ end }}
tmp:
enabled: true
type: emptyDir
targetSelector:
jellyfin:
jellyfin:
mountPath: /tmp
{{- range $idx, $storage := .Values.jellyfinStorage.additionalStorages }}
{{ printf "jellyfin-%v" (int $idx) }}:
{{- $size := "" -}}
{{- if $storage.size -}}
{{- $size = (printf "%vGi" $storage.size) -}}
{{- end }}
enabled: true
type: {{ $storage.type }}
datasetName: {{ $storage.datasetName | default "" }}
hostPath: {{ $storage.hostPath | default "" }}
server: {{ $storage.server | default "" }}
share: {{ $storage.share | default "" }}
domain: {{ $storage.domain | default "" }}
username: {{ $storage.username | default "" }}
password: {{ $storage.password | default "" }}
size: {{ $size }}
{{- if eq $storage.type "smb-pv-pvc" }}
mountOptions:
- key: noperm
{{- end }}
targetSelector:
jellyfin:
jellyfin:
mountPath: {{ $storage.mountPath }}
01-permissions:
mountPath: /mnt/directories{{ $storage.mountPath }}
{{- end }}
{{ with .Values.jellyfinGPU }}
scaleGPU:
{{ range $key, $value := . }}
- gpu:
{{ $key }}: {{ $value }}
targetSelector:
jellyfin:
- jellyfin
{{ end }}
{{ end }}
{{- end -}}

View File

@@ -0,0 +1,16 @@
{{- define "jellyfin.portal" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
data:
path: "/"
{{- $port := .Values.jellyfinNetwork.webPort -}}
{{- if .Values.jellyfinNetwork.hostNetwork -}}
{{- $port = 8096 -}}
{{- end }}
port: {{ $port | quote }}
protocol: http
host: $node_ip
{{- end -}}

View File

@@ -0,0 +1,9 @@
{{- include "ix.v1.common.loader.init" . -}}
{{/* Merge the templates with Values */}}
{{- $_ := mustMergeOverwrite .Values (include "jellyfin.workload" $ | fromYaml) -}}
{{/* Create the configmap for portal manually*/}}
{{- include "jellyfin.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'[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)))

View File

@@ -0,0 +1,33 @@
image:
repository: jellyfin/jellyfin
pullPolicy: IfNotPresent
tag: '10.8.10'
resources:
limits:
cpu: 4000m
memory: 8Gi
jellyfinConfig:
publishedServerUrl: ''
additionalEnvs: []
jellyfinGPU: {}
jellyfinNetwork:
webPort: 30013
hostNetwork: false
jellyfinRunAs:
user: 568
group: 568
jellyfinStorage:
config:
type: ixVolume
datasetName: config
cache:
type: ixVolume
datasetName: cache
transcodes:
type: ixVolume
datasetName: transcodes
medium: ''
size: ''
additionalStorages: []

View File

@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: file://../../../common
version: 1.1.1
digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7
generated: "2023-09-21T15:59:14.078456648+03:00"

View File

@@ -0,0 +1,26 @@
name: sonarr
description: Sonarr is a PVR for Usenet and BitTorrent users.
annotations:
title: Sonarr
type: application
version: 1.0.16
apiVersion: v2
appVersion: '3.0.10.1567'
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://github.com/Sonarr/Sonarr
icon: https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png
sources:
- https://github.com/onedr0p/containers/tree/main/apps/sonarr
- https://github.com/truenas/charts/tree/master/community/sonarr
- https://github.com/Sonarr/Sonarr
keywords:
- media
- series

View File

@@ -0,0 +1,8 @@
# Sonarr
[Sonarr](https://github.com/Sonarr/Sonarr) is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them.
> When application is installed, a container will be launched with **root** privileges.
> This is required in order to apply the correct permissions to the `Sonarr` directories.
> Afterward, the `Sonarr` 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 @@
# Sonarr
[Sonarr](https://github.com/Sonarr/Sonarr) is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them.
> When application is installed, a container will be launched with **root** privileges.
> This is required in order to apply the correct permissions to the `Sonarr` directories.
> Afterward, the `Sonarr` 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.

Binary file not shown.

View File

@@ -0,0 +1,11 @@
sonarrNetwork:
webPort: 31000
sonarrRunAs:
user: 1000
group: 1000
sonarrStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config

View File

@@ -0,0 +1,21 @@
sonarrConfig:
additionalEnvs:
- name: SONARR__API_KEY
value: some-long-api-key
- name: SONARR__LOG_LEVEL
value: error
sonarrNetwork:
webPort: 31000
sonarrStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config
additionalStorages:
- type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/action_series
mountPath: /action_series
- type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/adventure_series
mountPath: /adventure_series

View File

@@ -0,0 +1,8 @@
sonarrNetwork:
webPort: 30000
hostNetwork: true
sonarrStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config

View File

@@ -0,0 +1,9 @@
icon_url: https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png
categories:
- media
screenshots:
- https://sonarr.tv/img/features/calendar.png
- https://sonarr.tv/img/features/manualsearch.png
- https://sonarr.tv/img/features/blocklist.png
tags:
- series

View File

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

View File

@@ -0,0 +1,29 @@
#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
storageKey = 'sonarrStorage'
storages = ['config']
for storage in storages:
check_val = values.get(storageKey, {}).get(storage, {})
if not isinstance(check_val, dict) or not check_val or check_val.get('type', 'hostPath') == 'hostPath':
continue
values[storageKey][storage] = {key: value for key, value in check_val.items() if key != 'hostPath'}
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))

View File

@@ -0,0 +1,286 @@
groups:
- name: Sonarr Configuration
description: Configure Sonarr
- name: User and Group Configuration
description: Configure User and Group for Sonarr
- name: Network Configuration
description: Configure Network for Sonarr
- name: Storage Configuration
description: Configure Storage for Sonarr
- name: Resources Configuration
description: Configure Resources for Sonarr
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: sonarrConfig
label: ""
group: Sonarr Configuration
schema:
type: dict
attrs:
- variable: instanceName
label: Instance Name
description: The name of the Sonarr instance.
schema:
type: string
default: "Sonarr"
required: true
- variable: additionalEnvs
label: Additional Environment Variables
description: Configure additional environment variables for Sonarr.
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: sonarrRunAs
label: ""
group: User and Group Configuration
schema:
type: dict
attrs:
- variable: user
label: User ID
description: The user id that Sonarr will run as.
schema:
type: int
min: 2
default: 568
required: true
- variable: group
label: Group ID
description: The group id that Sonarr will run as.
schema:
type: int
min: 2
default: 568
required: true
- variable: sonarrNetwork
label: ""
group: Network Configuration
schema:
type: dict
attrs:
- variable: webPort
label: Web Port
description: The port for the Sonarr Web UI.
schema:
type: int
default: 30027
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: sonarrStorage
label: ""
group: Storage Configuration
schema:
type: dict
attrs:
- variable: config
label: Sonarr Config Storage
description: The path to store Sonarr 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: additionalStorages
label: Additional Storage
description: Additional storage for Sonarr.
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)
- value: "smb-pv-pvc"
description: SMB Share (Mounts a persistent volume claim to a SMB share)
- 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: server
label: Server
description: The server for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
- variable: share
label: Share
description: The share name for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
- variable: domain
label: Domain (Optional)
description: The domain for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
- variable: username
label: Username
description: The username for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
- variable: password
label: Password
description: The password for the SMB share.
schema:
type: string
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
private: true
- variable: size
label: Size (in Gi)
description: The size of the volume quota.
schema:
type: int
show_if: [["type", "=", "smb-pv-pvc"]]
required: true
min: 1
default: 1
- 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 Sonarr.
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 Sonarr.
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,12 @@
{{- define "sonarr.portal" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
data:
path: "/"
port: {{ .Values.sonarrNetwork.webPort | quote }}
protocol: http
host: $node_ip
{{- end -}}

View File

@@ -0,0 +1,112 @@
{{- define "sonarr.workload" -}}
workload:
sonarr:
enabled: true
primary: true
type: Deployment
podSpec:
hostNetwork: {{ .Values.sonarrNetwork.hostNetwork }}
containers:
sonarr:
enabled: true
primary: true
imageSelector: image
securityContext:
runAsUser: {{ .Values.sonarrRunAs.user }}
runAsGroup: {{ .Values.sonarrRunAs.group }}
env:
SONARR__PORT: {{ .Values.sonarrNetwork.webPort }}
SONARR__INSTANCE_NAME: {{ .Values.sonarrConfig.instanceName }}
{{ with .Values.sonarrConfig.additionalEnvs }}
envList:
{{ range $env := . }}
- name: {{ $env.name }}
value: {{ $env.value }}
{{ end }}
{{ end }}
probes:
liveness:
enabled: true
type: http
port: "{{ .Values.sonarrNetwork.webPort }}"
path: /ping
readiness:
enabled: true
type: http
port: "{{ .Values.sonarrNetwork.webPort }}"
path: /ping
startup:
enabled: true
type: http
port: "{{ .Values.sonarrNetwork.webPort }}"
path: /ping
initContainers:
{{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
"UID" .Values.sonarrRunAs.user
"GID" .Values.sonarrRunAs.group
"mode" "check"
"type" "init") | nindent 8 }}
{{/* Service */}}
service:
sonarr:
enabled: true
primary: true
type: NodePort
targetSelector: sonarr
ports:
webui:
enabled: true
primary: true
port: {{ .Values.sonarrNetwork.webPort }}
nodePort: {{ .Values.sonarrNetwork.webPort }}
targetSelector: sonarr
{{/* Persistence */}}
persistence:
config:
enabled: true
type: {{ .Values.sonarrStorage.config.type }}
datasetName: {{ .Values.sonarrStorage.config.datasetName | default "" }}
hostPath: {{ .Values.sonarrStorage.config.hostPath | default "" }}
targetSelector:
sonarr:
sonarr:
mountPath: /config
01-permissions:
mountPath: /mnt/directories/config
tmp:
enabled: true
type: emptyDir
targetSelector:
sonarr:
sonarr:
mountPath: /tmp
{{- range $idx, $storage := .Values.sonarrStorage.additionalStorages }}
{{ printf "sonarr-%v" (int $idx) }}:
{{- $size := "" -}}
{{- if $storage.size -}}
{{- $size = (printf "%vGi" $storage.size) -}}
{{- end }}
enabled: true
type: {{ $storage.type }}
datasetName: {{ $storage.datasetName | default "" }}
hostPath: {{ $storage.hostPath | default "" }}
server: {{ $storage.server | default "" }}
share: {{ $storage.share | default "" }}
domain: {{ $storage.domain | default "" }}
username: {{ $storage.username | default "" }}
password: {{ $storage.password | default "" }}
size: {{ $size }}
{{- if eq $storage.type "smb-pv-pvc" }}
mountOptions:
- key: noperm
{{- end }}
targetSelector:
sonarr:
sonarr:
mountPath: {{ $storage.mountPath }}
01-permissions:
mountPath: /mnt/directories{{ $storage.mountPath }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,9 @@
{{- include "ix.v1.common.loader.init" . -}}
{{/* Merge the templates with Values */}}
{{- $_ := mustMergeOverwrite .Values (include "sonarr.workload" $ | fromYaml) -}}
{{/* Create the configmap for portal manually*/}}
{{- include "sonarr.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'[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)))

View File

@@ -0,0 +1,24 @@
image:
repository: ghcr.io/onedr0p/sonarr
pullPolicy: IfNotPresent
tag: '3.0.10.1567'
resources:
limits:
cpu: 4000m
memory: 8Gi
sonarrConfig:
instanceName: Sonarr
additionalEnvs: []
sonarrNetwork:
webPort: 30027
hostNetwork: false
sonarrRunAs:
user: 568
group: 568
sonarrStorage:
config:
type: ixVolume
datasetName: config
additionalStorages: []