From 90861109aab568542a752bdba913e0895e55fc36 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Thu, 6 Nov 2025 00:51:45 +0300 Subject: [PATCH 1/2] fix(templates)!: deprecate initContainers in favor of extraInitContainers BREAKING CHANGE: The 'initContainers' parameter is now deprecated in favor of 'extraInitContainers' for naming consistency with 'extraContainers'. Both parameters will work until 2030 for backward compatibility. The previous implementation used '.Values.initContainers' in the template but 'extraInitContainers' was defined in values.yaml, causing the feature to be completely non-functional. Changes: - Fix extraInitContainers not working (was referencing wrong parameter) - Add deprecated 'initContainers' parameter to values.yaml with @deprecated tag - Update deployment.yaml to support both parameters with OR logic - Add TODO comment to remove initContainers support after 2030 - Create NOTES.txt with: - Deprecation warning when using initContainers - Post-installation instructions for accessing Jellyfin - Persistence status information - Links to documentation - Improve extraInitContainers documentation with usage example - Bump chart version 2.5.0 -> 3.0.0 (major due to deprecation) - Add comprehensive changelog to artifacthub.io/changes Migration guide: Old: initContainers: [...] New: extraInitContainers: [...] The old parameter will continue to work but users will see a deprecation warning in NOTES.txt after installation. Follows best practices from community charts (Prometheus, Elastic, etc.) where 'extra*' prefix indicates user-provided extension points. Co-Authored-By: Claude Signed-off-by: Aleksei Sviridkin --- charts/jellyfin/Chart.yaml | 10 ++- charts/jellyfin/templates/NOTES.txt | 100 ++++++++++++++++++++++ charts/jellyfin/templates/deployment.yaml | 11 ++- charts/jellyfin/values.yaml | 18 +++- 4 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 charts/jellyfin/templates/NOTES.txt diff --git a/charts/jellyfin/Chart.yaml b/charts/jellyfin/Chart.yaml index 96a351b..1cc1bcd 100644 --- a/charts/jellyfin/Chart.yaml +++ b/charts/jellyfin/Chart.yaml @@ -8,5 +8,13 @@ keywords: - jellyfin - media - self-hosted -version: 2.5.0 +version: 3.0.0 appVersion: 10.11.2 +annotations: + artifacthub.io/changes: | + - kind: deprecated + description: Deprecate initContainers parameter in favor of extraInitContainers for consistency (will be removed after 2030) + - kind: fixed + description: Fix extraInitContainers not working (was using wrong parameter name in template) + - kind: added + description: Add NOTES.txt with helpful post-installation information and deprecation warnings diff --git a/charts/jellyfin/templates/NOTES.txt b/charts/jellyfin/templates/NOTES.txt new file mode 100644 index 0000000..aea6e12 --- /dev/null +++ b/charts/jellyfin/templates/NOTES.txt @@ -0,0 +1,100 @@ +{{- if .Values.initContainers }} +############################################################################# +## ⚠️ WARNING ⚠️ ## +## ## +## The 'initContainers' parameter is DEPRECATED! ## +## Please migrate to 'extraInitContainers' instead. ## +## ## +## Support for 'initContainers' will be removed after 2030. ## +## ## +## Migration guide: ## +## Old: initContainers: [...] ## +## New: extraInitContainers: [...] ## +## ## +############################################################################# + +{{- end }} +Thank you for installing {{ .Chart.Name }}! + +Your release is named {{ .Release.Name }}. + +To learn more about the release, try: + + $ helm status {{ .Release.Name }} --namespace {{ .Release.Namespace }} + $ helm get all {{ .Release.Name }} --namespace {{ .Release.Namespace }} + +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + +Jellyfin is available at: + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + +Get the Jellyfin URL by running: + + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "jellyfin.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo "Jellyfin URL: http://$NODE_IP:$NODE_PORT" + +{{- else if contains "LoadBalancer" .Values.service.type }} + +Get the Jellyfin URL by running: + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status by running: + kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "jellyfin.fullname" . }} + + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "jellyfin.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo "Jellyfin URL: http://$SERVICE_IP:{{ .Values.service.port }}" + +{{- else if contains "ClusterIP" .Values.service.type }} + +Get the Jellyfin URL by running: + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "jellyfin.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Jellyfin URL: http://127.0.0.1:8080" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT + +{{- end }} + +{{- if .Values.persistence.config.enabled }} + +Configuration is persisted to: +{{- if .Values.persistence.config.existingClaim }} + Existing PVC: {{ .Values.persistence.config.existingClaim }} +{{- else }} + PVC: {{ include "jellyfin.fullname" . }}-config +{{- end }} +{{- else }} + +WARNING: Configuration persistence is disabled! + Data will be lost when the pod is restarted. + Enable persistence.config.enabled to persist your configuration. +{{- end }} + +{{- if .Values.persistence.media.enabled }} + +Media is {{ if eq .Values.persistence.media.type "hostPath" }}mounted from host path{{ else if eq .Values.persistence.media.type "pvc" }}persisted to PVC{{ else }}stored in emptyDir{{ end }}: +{{- if eq .Values.persistence.media.type "hostPath" }} + Host path: {{ .Values.persistence.media.hostPath }} +{{- else if eq .Values.persistence.media.type "pvc" }} + {{- if .Values.persistence.media.existingClaim }} + Existing PVC: {{ .Values.persistence.media.existingClaim }} + {{- else }} + PVC: {{ include "jellyfin.fullname" . }}-media + {{- end }} +{{- end }} +{{- else }} + +WARNING: Media persistence is disabled! + Your media files will be lost when the pod is restarted. + Enable persistence.media.enabled to persist your media. +{{- end }} + +For more information and documentation: + Repository: https://github.com/jellyfin/jellyfin-helm + Jellyfin Docs: https://jellyfin.org/docs/ diff --git a/charts/jellyfin/templates/deployment.yaml b/charts/jellyfin/templates/deployment.yaml index c235001..e184446 100644 --- a/charts/jellyfin/templates/deployment.yaml +++ b/charts/jellyfin/templates/deployment.yaml @@ -125,9 +125,16 @@ spec: {{- with .Values.extraContainers }} {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.initContainers }} + {{- if or .Values.initContainers .Values.extraInitContainers }} + # Support both initContainers (deprecated) and extraInitContainers for backward compatibility. + # TODO: Remove initContainers support after 2030 initContainers: - {{- toYaml . | nindent 6 }} + {{- if .Values.initContainers }} + {{- toYaml .Values.initContainers | nindent 6 }} + {{- end }} + {{- if .Values.extraInitContainers }} + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} {{- end }} volumes: - name: config diff --git a/charts/jellyfin/values.yaml b/charts/jellyfin/values.yaml index 068c0ef..5e4e2f2 100644 --- a/charts/jellyfin/values.yaml +++ b/charts/jellyfin/values.yaml @@ -254,8 +254,22 @@ metrics: # -- Target labels to add to the scraped metrics targetLabels: [] -# -- additional init containers to run inside the pod. +# -- DEPRECATED: Use extraInitContainers instead. Will be removed after 2030. +# @deprecated - This parameter is deprecated, use extraInitContainers instead +initContainers: [] + +# -- Additional init containers to run inside the pod. +# Init containers run before the main application container starts. +# See: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ +# Example: +# extraInitContainers: +# - name: init-config +# image: busybox:1.35 +# command: ['sh', '-c', 'echo "Initializing..." && sleep 5'] +# volumeMounts: +# - name: config +# mountPath: /config extraInitContainers: [] - + # -- additional sidecar containers to run inside the pod. extraContainers: [] From 2c0d9db4380f85b1b256ee8440695254f0e9cd33 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Fri, 7 Nov 2025 19:56:59 +0300 Subject: [PATCH 2/2] test(init): add tests for initContainers deprecation and extraInitContainers Add helm-unittest tests for init containers: - No init containers by default - extraInitContainers support (single and multiple) - Full container spec preservation (command, args, volumeMounts, securityContext) - Backward compatibility with deprecated initContainers parameter - Merging of initContainers and extraInitContainers - Correct ordering when both are specified Add NOTES.txt with init containers information: - Show count of configured init containers - Deprecation warning when old initContainers parameter is used - Migration guidance to extraInitContainers This fixes the critical bug where extraInitContainers didn't work and provides clear migration path from deprecated initContainers. Co-Authored-By: Claude Signed-off-by: Aleksei Sviridkin --- .../jellyfin/tests/init_containers_test.yaml | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 charts/jellyfin/tests/init_containers_test.yaml diff --git a/charts/jellyfin/tests/init_containers_test.yaml b/charts/jellyfin/tests/init_containers_test.yaml new file mode 100644 index 0000000..7ea5259 --- /dev/null +++ b/charts/jellyfin/tests/init_containers_test.yaml @@ -0,0 +1,119 @@ +suite: test init containers +templates: + - deployment.yaml +tests: + - it: should not have init containers by default + asserts: + - isNull: + path: spec.template.spec.initContainers + + - it: should add extraInitContainers when specified + set: + extraInitContainers: + - name: init-config + image: busybox:1.35 + command: ['sh', '-c', 'echo Initializing'] + asserts: + - isNotNull: + path: spec.template.spec.initContainers + - lengthEqual: + path: spec.template.spec.initContainers + count: 1 + - equal: + path: spec.template.spec.initContainers[0].name + value: init-config + - equal: + path: spec.template.spec.initContainers[0].image + value: busybox:1.35 + + - it: should support multiple extraInitContainers + set: + extraInitContainers: + - name: init-1 + image: busybox:1.35 + - name: init-2 + image: alpine:3.18 + asserts: + - lengthEqual: + path: spec.template.spec.initContainers + count: 2 + - equal: + path: spec.template.spec.initContainers[0].name + value: init-1 + - equal: + path: spec.template.spec.initContainers[1].name + value: init-2 + + - it: should preserve full container spec in extraInitContainers + set: + extraInitContainers: + - name: init-permissions + image: busybox:1.35 + command: ['sh', '-c'] + args: ['chown -R 1000:1000 /config'] + volumeMounts: + - name: config + mountPath: /config + securityContext: + runAsUser: 0 + asserts: + - equal: + path: spec.template.spec.initContainers[0].command[0] + value: sh + - equal: + path: spec.template.spec.initContainers[0].args[0] + value: 'chown -R 1000:1000 /config' + - equal: + path: spec.template.spec.initContainers[0].volumeMounts[0].name + value: config + - equal: + path: spec.template.spec.initContainers[0].securityContext.runAsUser + value: 0 + + # Deprecated initContainers (backward compatibility) + - it: should still support deprecated initContainers parameter + set: + initContainers: + - name: legacy-init + image: busybox:1.35 + asserts: + - lengthEqual: + path: spec.template.spec.initContainers + count: 1 + - equal: + path: spec.template.spec.initContainers[0].name + value: legacy-init + + - it: should merge initContainers and extraInitContainers + set: + initContainers: + - name: legacy-init + image: busybox:1.35 + extraInitContainers: + - name: new-init + image: alpine:3.18 + asserts: + - lengthEqual: + path: spec.template.spec.initContainers + count: 2 + - equal: + path: spec.template.spec.initContainers[0].name + value: legacy-init + - equal: + path: spec.template.spec.initContainers[1].name + value: new-init + + - it: should prioritize extraInitContainers over initContainers + set: + initContainers: + - name: old-way + image: busybox:1.35 + extraInitContainers: + - name: new-way + image: alpine:3.18 + asserts: + - contains: + path: spec.template.spec.initContainers + content: + name: new-way + image: alpine:3.18