Skip to content

Commit d7151c0

Browse files
committed
[SPARK-57940] Enable readOnlyRootFilesystem for operator container in Helm chart
### What changes were proposed in this pull request? This PR aims to enable `readOnlyRootFilesystem` for the operator container in the Helm chart. Since the operator writes temporary files under `java.io.tmpdir` (SPARK-57918), an `emptyDir` volume is mounted at `/tmp`, following the existing `logs-volume` pattern. ### Why are the changes needed? A read-only root filesystem prevents tampering with the container image at runtime and completes the CIS Benchmark hardening on top of the existing restricted Pod Security Standard compliance. ### Does this PR introduce _any_ user-facing change? Yes. The operator container root filesystem becomes read-only by default; writable paths are provided via `emptyDir` volumes (`/tmp`, `/opt/spark-operator/logs`). Users can override `operatorDeployment.operatorPod.operatorContainer.securityContext` if needed. ### How was this patch tested? Pass the CIs. Also manually verified with `helm lint --strict` and `helm template`. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Fable 5 Closes #743 from dongjoon-hyun/SPARK-57940. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent cac534c commit d7151c0

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

build-tools/helm/spark-kubernetes-operator/templates/spark-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ spec:
148148
mountPath: /opt/spark-operator/conf
149149
- name: logs-volume
150150
mountPath: /opt/spark-operator/logs
151+
- name: tmp-volume
152+
mountPath: /tmp
151153
{{- if and .Values.operatorConfiguration.dynamicConfig.enable (eq .Values.operatorConfiguration.dynamicConfig.source "file") }}
152154
- name: spark-operator-dynamic-config-volume
153155
mountPath: /opt/spark-operator/dynamic-conf
@@ -175,6 +177,8 @@ spec:
175177
name: spark-kubernetes-operator-configuration
176178
- name: logs-volume
177179
emptyDir: { }
180+
- name: tmp-volume
181+
emptyDir: { }
178182
{{- if and .Values.operatorConfiguration.dynamicConfig.enable (eq .Values.operatorConfiguration.dynamicConfig.source "file") }}
179183
- name: spark-operator-dynamic-config-volume
180184
configMap:

build-tools/helm/spark-kubernetes-operator/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ operatorDeployment:
7878
capabilities:
7979
drop:
8080
- ALL
81+
readOnlyRootFilesystem: true
8182
runAsNonRoot: true
8283
runAsUser: 185
8384
seccompProfile:

0 commit comments

Comments
 (0)