From 73cd82bd2d54cde91b2a3b9232ebc97b63319adb Mon Sep 17 00:00:00 2001 From: Gabriel Somoza Date: Tue, 2 Dec 2025 15:02:04 +0100 Subject: [PATCH 1/2] feat: add support for custom initContainers Add the ability to specify custom initContainers via deployment.initContainers in values.yaml. When specified, custom initContainers override the default volume-permissions initContainer, providing full flexibility for initialization logic while maintaining backward compatibility. --- charts/stirling-pdf/templates/deployment.yaml | 6 +++++- charts/stirling-pdf/values.yaml | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/charts/stirling-pdf/templates/deployment.yaml b/charts/stirling-pdf/templates/deployment.yaml index 63f9505..735943b 100644 --- a/charts/stirling-pdf/templates/deployment.yaml +++ b/charts/stirling-pdf/templates/deployment.yaml @@ -44,7 +44,11 @@ spec: {{- if .Values.securityContext.supplementalGroups }} supplementalGroups: {{ .Values.securityContext.supplementalGroups }} {{- end }} - {{- else if .Values.persistence.enabled }} + {{- end }} + {{- if .Values.deployment.initContainers }} + initContainers: + {{- toYaml .Values.deployment.initContainers | nindent 8 }} + {{- else if and (not .Values.securityContext.enabled) .Values.persistence.enabled }} initContainers: - name: volume-permissions image: {{ template "stirlingpdf.volumePermissions.image" . }} diff --git a/charts/stirling-pdf/values.yaml b/charts/stirling-pdf/values.yaml index 16e359c..5fc1558 100644 --- a/charts/stirling-pdf/values.yaml +++ b/charts/stirling-pdf/values.yaml @@ -53,6 +53,19 @@ deployment: # secretName: nginx-config # -- Additional volumes to mount extraVolumeMounts: [] + # -- Custom initContainers specification + # -- If specified, these initContainers will be used instead of the default + # -- volume-permissions initContainer. This allows full control over the + # -- initContainer configuration. + # -- NOTE: When this is set, it completely overrides the default initContainer + # -- behavior. Make sure to include any necessary volume permission setup if needed. + initContainers: [] + # - name: custom-init + # image: busybox:latest + # command: ['sh', '-c', 'echo Initializing...'] + # volumeMounts: + # - name: storage-volume + # mountPath: /tmp # -- sidecarContainers for the stirling-pdf # -- Can be used to add a proxy to the pod that does # -- scanning for secrets, signing, authentication, validation From 7cce1ca0196f195858a4bedd86e10f5aab67a79b Mon Sep 17 00:00:00 2001 From: Gabriel Somoza Date: Tue, 2 Dec 2025 15:06:35 +0100 Subject: [PATCH 2/2] feat: update initContainers logic to avoid BC break and improve documentation in values.yaml --- charts/stirling-pdf/templates/deployment.yaml | 2 +- charts/stirling-pdf/values.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/stirling-pdf/templates/deployment.yaml b/charts/stirling-pdf/templates/deployment.yaml index 735943b..4b0a50c 100644 --- a/charts/stirling-pdf/templates/deployment.yaml +++ b/charts/stirling-pdf/templates/deployment.yaml @@ -48,7 +48,7 @@ spec: {{- if .Values.deployment.initContainers }} initContainers: {{- toYaml .Values.deployment.initContainers | nindent 8 }} - {{- else if and (not .Values.securityContext.enabled) .Values.persistence.enabled }} + {{- else if .Values.persistence.enabled }} initContainers: - name: volume-permissions image: {{ template "stirlingpdf.volumePermissions.image" . }} diff --git a/charts/stirling-pdf/values.yaml b/charts/stirling-pdf/values.yaml index 5fc1558..88ccd5c 100644 --- a/charts/stirling-pdf/values.yaml +++ b/charts/stirling-pdf/values.yaml @@ -54,11 +54,11 @@ deployment: # -- Additional volumes to mount extraVolumeMounts: [] # -- Custom initContainers specification - # -- If specified, these initContainers will be used instead of the default - # -- volume-permissions initContainer. This allows full control over the - # -- initContainer configuration. - # -- NOTE: When this is set, it completely overrides the default initContainer - # -- behavior. Make sure to include any necessary volume permission setup if needed. + # If specified, these initContainers will be used instead of the default + # volume-permissions initContainer. This allows full control over the + # initContainer configuration. + # NOTE: When this is set, it completely overrides the default initContainer + # behavior. Make sure to include any necessary volume permission setup if needed. initContainers: [] # - name: custom-init # image: busybox:latest