From 789cbd925083f2c85c8d8c2e4d4ae6db7af9208c Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Tue, 6 Oct 2026 09:27:57 +0200 Subject: [PATCH 1/2] feat(template): Write operator file logs to an emptyDir under /var/log This makes it possible for us to switch to a read-only root filesystem. And it causes the logs to survive a container restart. --- .../helm/[[operator]]/templates/_telemetry.tpl.j2 | 9 ++++++++- .../helm/[[operator]]/templates/deployment.yaml.j2 | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 index ccf5b5cf..10b5d3bb 100644 --- a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 @@ -1,3 +1,10 @@ +{{/* +Shared by FILE_LOG_DIRECTORY and the log volume mount in deployment.yaml, which have to agree. +*/}} +{{- define "{[ operator.name }].telemetry.fileLogDirectory" -}} +/var/log/{{ include "{[ operator.name }].appname" . }} +{{- end }} + {{/* Create a list of telemetry related env vars. */}} @@ -17,7 +24,7 @@ Create a list of telemetry related env vars. {{ end }} {{- if .fileLog.enabled }} - name: FILE_LOG_DIRECTORY - value: /stackable/logs/{{ include "{[ operator.name }].appname" $ }} + value: {{ include "{[ operator.name }].telemetry.fileLogDirectory" $ }} {{- end }} {{- if and .fileLog.enabled .fileLog.level }} - name: FILE_LOG_LEVEL diff --git a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 index 288cfcae..34359254 100644 --- a/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 +++ b/template/deploy/helm/[[operator]]/templates/deployment.yaml.j2 @@ -103,6 +103,11 @@ spec: periodSeconds: 3 failureThreshold: 30 timeoutSeconds: 3 + {{- if .Values.telemetry.fileLog.enabled }} + volumeMounts: + - name: log + mountPath: {{ include "{[ operator.name }].telemetry.fileLogDirectory" . }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -118,6 +123,11 @@ spec: {{- with .Values.priorityClassName }} priorityClassName: {{ . }} {{- end }} + {{- if .Values.telemetry.fileLog.enabled }} + volumes: + - name: log + emptyDir: {} + {{- end }} {[% else %}] # Templated Deployment disabled for this operator {[% endif %}] From 7b4ef35dc45e3395d69f67b5c218fd3f83b9d695 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Tue, 6 Oct 2026 10:14:19 +0200 Subject: [PATCH 2/2] Update template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com> --- template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 index 10b5d3bb..ed44aea0 100644 --- a/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 +++ b/template/deploy/helm/[[operator]]/templates/_telemetry.tpl.j2 @@ -1,5 +1,5 @@ {{/* -Shared by FILE_LOG_DIRECTORY and the log volume mount in deployment.yaml, which have to agree. +Used by FILE_LOG_DIRECTORY and the log volume mount in deployment.yaml, which have to agree. */}} {{- define "{[ operator.name }].telemetry.fileLogDirectory" -}} /var/log/{{ include "{[ operator.name }].appname" . }}