Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
kind: fix
date: 2025-10-01
---

* **MongoDB Kubernetes Operator**: Operator crashed when `securityContext.readOnlyRootFilesystem=true` was set, because it was trying to create `/tmp/k8s-webhook-server` directory that was unmounted.
6 changes: 6 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ spec:
- -watch-resource=clustermongodbroles
command:
- /usr/local/bin/mongodb-kubernetes-operator
volumeMounts:
- mountPath: /tmp/k8s-webhook-server
name: webhook-server-dir
resources:
limits:
cpu: 1100m
Expand Down Expand Up @@ -313,3 +316,6 @@ spec:
value: "mongodb-search"
- name: MDB_SEARCH_VERSION
value: "0.53.1"
volumes:
- name: webhook-server-dir
emptyDir: {}
13 changes: 10 additions & 3 deletions helm_chart/templates/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
securityContext:
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000
fsGroup: 2000
seccompProfile:
type: RuntimeDefault
{{- end }}
Expand Down Expand Up @@ -64,8 +66,10 @@ spec:
command:
- /usr/local/bin/mongodb-kubernetes-operator
{{- end }}
{{- if .Values.multiCluster.clusters }}
volumeMounts:
- mountPath: /tmp/k8s-webhook-server
name: webhook-server-dir
{{- if .Values.multiCluster.clusters }}
- mountPath: /etc/config/kubeconfig
name: kube-config-volume
{{- end }}
Expand All @@ -79,6 +83,7 @@ spec:
{{- if not .Values.managedSecurityContext }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
Expand Down Expand Up @@ -290,13 +295,15 @@ spec:
value: '{{ (split "=" .)._1 }}'
{{- end }}
{{- end }}
{{- if .Values.multiCluster.clusters }}
volumes:
- name: webhook-server-dir
emptyDir: {}
{{- if .Values.multiCluster.clusters }}
- name: kube-config-volume
secret:
defaultMode: 420
secretName: {{ .Values.multiCluster.kubeConfigSecretName }}
{{- end }}
{{- end }}

{{- with .Values.operator }}
{{- with .nodeSelector }}
Expand Down
7 changes: 7 additions & 0 deletions public/mongodb-kubernetes-multi-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ spec:
securityContext:
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000
fsGroup: 2000
seccompProfile:
type: RuntimeDefault
containers:
Expand All @@ -346,6 +348,8 @@ spec:
command:
- /usr/local/bin/mongodb-kubernetes-operator
volumeMounts:
- mountPath: /tmp/k8s-webhook-server
name: webhook-server-dir
- mountPath: /etc/config/kubeconfig
name: kube-config-volume
resources:
Expand All @@ -357,6 +361,7 @@ spec:
memory: 200Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
Expand Down Expand Up @@ -445,6 +450,8 @@ spec:
- name: MDB_SEARCH_VERSION
value: "0.53.1"
volumes:
- name: webhook-server-dir
emptyDir: {}
- name: kube-config-volume
secret:
defaultMode: 420
Expand Down
6 changes: 6 additions & 0 deletions public/mongodb-kubernetes-openshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ spec:
- -watch-resource=clustermongodbroles
command:
- /usr/local/bin/mongodb-kubernetes-operator
volumeMounts:
- mountPath: /tmp/k8s-webhook-server
name: webhook-server-dir
resources:
limits:
cpu: 1100m
Expand Down Expand Up @@ -617,3 +620,6 @@ spec:
value: "mongodb-search"
- name: MDB_SEARCH_VERSION
value: "0.53.1"
volumes:
- name: webhook-server-dir
emptyDir: {}
9 changes: 9 additions & 0 deletions public/mongodb-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ spec:
securityContext:
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000
fsGroup: 2000
seccompProfile:
type: RuntimeDefault
containers:
Expand All @@ -344,6 +346,9 @@ spec:
- -watch-resource=clustermongodbroles
command:
- /usr/local/bin/mongodb-kubernetes-operator
volumeMounts:
- mountPath: /tmp/k8s-webhook-server
name: webhook-server-dir
resources:
limits:
cpu: 1100m
Expand All @@ -353,6 +358,7 @@ spec:
memory: 200Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
Expand Down Expand Up @@ -440,3 +446,6 @@ spec:
value: "mongodb-search"
- name: MDB_SEARCH_VERSION
value: "0.53.1"
volumes:
- name: webhook-server-dir
emptyDir: {}