From afaa5222ed501a61dc2d4d2d6b40b03d660571c8 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Mon, 29 Sep 2025 00:29:17 +0200 Subject: [PATCH] jellyfin: Add an initial Chart --- .gitignore | 5 ++ README.md | 14 +++++ common/.helmignore | 23 +++++++ common/Chart.yaml | 6 ++ common/templates/_templates.tpl | 5 ++ common/values.yaml | 0 jellyfin/.helmignore | 23 +++++++ jellyfin/Chart.lock | 6 ++ jellyfin/Chart.yaml | 11 ++++ jellyfin/templates/deployment.yaml | 60 +++++++++++++++++++ jellyfin/templates/persistentvolumeclaim.yaml | 45 ++++++++++++++ jellyfin/templates/service.yaml | 15 +++++ jellyfin/values.yaml | 22 +++++++ 13 files changed, 235 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 common/.helmignore create mode 100644 common/Chart.yaml create mode 100644 common/templates/_templates.tpl create mode 100644 common/values.yaml create mode 100644 jellyfin/.helmignore create mode 100644 jellyfin/Chart.lock create mode 100644 jellyfin/Chart.yaml create mode 100644 jellyfin/templates/deployment.yaml create mode 100644 jellyfin/templates/persistentvolumeclaim.yaml create mode 100644 jellyfin/templates/service.yaml create mode 100644 jellyfin/values.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..99540af --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea/ +infra-charts.iml + +# Chart dependencies +**/charts/*.tgz \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..bbcdac6 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# infra-charts + +Custom Helm Charts that do not exist like this anywhere else. + +## Requirements + +- Helm + +## Adding/Modifying Charts + +To create a new Helm Chart, run `helm create `. Make sure to depend on the local `common` Chart as it provides +common templates, like application labels, etc. + +When done, run `helm lint ` to lint the Helm Chart. \ No newline at end of file diff --git a/common/.helmignore b/common/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/common/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/common/Chart.yaml b/common/Chart.yaml new file mode 100644 index 0000000..8b86a4e --- /dev/null +++ b/common/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: common +description: Common helpers for Chart definitions +type: library +version: 0.1.0 +appVersion: "1.16.0" diff --git a/common/templates/_templates.tpl b/common/templates/_templates.tpl new file mode 100644 index 0000000..4129c3d --- /dev/null +++ b/common/templates/_templates.tpl @@ -0,0 +1,5 @@ +{{- define "common.app.labels" -}} +app.kubernetes.io/name: {{ .name }} +app.kubernetes.io/version: {{ .version }} +app.kubernetes.io/managed-by: Helm +{{- end }} \ No newline at end of file diff --git a/common/values.yaml b/common/values.yaml new file mode 100644 index 0000000..e69de29 diff --git a/jellyfin/.helmignore b/jellyfin/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/jellyfin/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/jellyfin/Chart.lock b/jellyfin/Chart.lock new file mode 100644 index 0000000..cfa233d --- /dev/null +++ b/jellyfin/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../common + version: 0.1.0 +digest: sha256:636a65e9846bdff17cc4e65b0849061f783759a37aa51fb85ff6fd8ba5e68467 +generated: "2025-09-29T00:12:03.73138765+02:00" diff --git a/jellyfin/Chart.yaml b/jellyfin/Chart.yaml new file mode 100644 index 0000000..57b9fda --- /dev/null +++ b/jellyfin/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +name: jellyfin +description: A Helm chart Jellyfin +type: application +version: 0.1.0 +appVersion: "1.16.0" + +dependencies: + - name: common + version: 0.1.0 + repository: "file://../common" \ No newline at end of file diff --git a/jellyfin/templates/deployment.yaml b/jellyfin/templates/deployment.yaml new file mode 100644 index 0000000..98b076b --- /dev/null +++ b/jellyfin/templates/deployment.yaml @@ -0,0 +1,60 @@ +{{- $labelsenv := dict "name" "jellyfin" "version" .Values.imageVersion }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jellyfin + namespace: {{ .Values.namespace }} + labels: {{ include "common.app.labels" $labelsenv | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: {{ include "common.app.labels" $labelsenv | nindent 6 }} + template: + metadata: + labels: {{ include "common.app.labels" $labelsenv | nindent 8 }} + spec: + securityContext: + runAsUser: {{ .Values.security.user }} + runAsGroup: {{ .Values.security.group }} + runAsNonRoot: true + capabilities: + drop: + - ALL + containers: + - name: jellyfin + image: "{{ .Values.image }}:{{ .Values.imageVersion }}" + env: + - name: JELLYFIN_PublishedServerUrl + value: {{ .Values.network.externalUrl | quote }} + ports: + - containerPort: 8096 + protocol: TCP + name: http + livenessProbe: + httpGet: + path: /System/Ping + port: http + scheme: HTTP + readinessProbe: + httpGet: + path: /System/Ping + port: http + scheme: HTTP + volumeMounts: + - name: storage + mountPath: /storage + - name: config + mountPath: /config + - name: cache + mountPath: /var/cache/jellyfin + volumes: + - name: storage + persistentVolumeClaim: + claimName: {{ .Values.storage.data.claimName }} + - name: cache + persistentVolumeClaim: + claimName: {{ .Values.storage.cache.claimName }} + - name: config + persistentVolumeClaim: + claimName: {{ .Values.storage.config.claimName }} diff --git a/jellyfin/templates/persistentvolumeclaim.yaml b/jellyfin/templates/persistentvolumeclaim.yaml new file mode 100644 index 0000000..055684a --- /dev/null +++ b/jellyfin/templates/persistentvolumeclaim.yaml @@ -0,0 +1,45 @@ +{{- if .Values.storage.local }} +{{- $labelsenv := dict "name" "jellyfin" "version" .Values.imageVersion }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.storage.config.claimName }} + namespace: {{ .Values.namespace }} + labels: {{ include "common.app.labels" $labelsenv | nindent 4 }} +spec: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.storage.config.size }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.storage.cache.claimName }} + namespace: {{ .Values.namespace }} + labels: {{ include "common.app.labels" $labelsenv | nindent 4 }} +spec: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.storage.cache.size }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.storage.data.claimName }} + namespace: {{ .Values.namespace }} + labels: {{ include "common.app.labels" $labelsenv | nindent 4 }} +spec: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.storage.data.size }} +{{- end }} \ No newline at end of file diff --git a/jellyfin/templates/service.yaml b/jellyfin/templates/service.yaml new file mode 100644 index 0000000..5ed0539 --- /dev/null +++ b/jellyfin/templates/service.yaml @@ -0,0 +1,15 @@ +{{- $labelsenv := dict "name" "jellyfin" "version" .Values.imageVersion }} +--- +apiVersion: v1 +kind: Service +metadata: + name: jellyfin + namespace: {{ .Values.namespace }} + labels: {{ include "common.app.labels" $labelsenv | nindent 4 }} +spec: + selector: {{ include "common.app.labels" $labelsenv | nindent 4 }} + ports: + - port: 8096 + protocol: TCP + name: http + type: ClusterIP \ No newline at end of file diff --git a/jellyfin/values.yaml b/jellyfin/values.yaml new file mode 100644 index 0000000..2c9777c --- /dev/null +++ b/jellyfin/values.yaml @@ -0,0 +1,22 @@ +image: jellyfin/jellyfin +imageVersion: 10.10.6 +namespace: default + +network: + externalUrl: "http://localhost:8080" + +storage: + local: true + data: + claimName: "data-pvc" + size: 2Gi + config: + claimName: "config-pvc" + size: 2Gi + cache: + claimName: "cache-pvc" + size: 2Gi + +security: + user: 10000 + group: 10000 \ No newline at end of file