From 2fc1cf90e0c5c2c5e80b6ec2634f1db21da2aa98 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 8 Jun 2026 12:35:12 +0200 Subject: [PATCH] feat(helm): add option to disable log PVCs and mounts (#3189) Co-authored-by: cxymds --- helm/README.md | 2 +- helm/rustfs/templates/deployment.yaml | 12 +++++++++++- helm/rustfs/templates/pvc.yaml | 2 +- helm/rustfs/templates/statefulset.yaml | 9 +++++++++ helm/rustfs/values.yaml | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/helm/README.md b/helm/README.md index 1706df8ea..6d80ea443 100644 --- a/helm/README.md +++ b/helm/README.md @@ -25,7 +25,7 @@ RustFS helm chart supports **standalone and distributed mode**. For standalone m | config.rustfs.domains | string | `""` | Enable virtual host mode. | | config.rustfs.log_level | string | `"info"` | | | config.rustfs.obs_environment | string | `"development"` | | -| config.rustfs.obs_log_directory | string | `"/logs"` | | +| config.rustfs.obs_log_directory | string | `"/logs"` | Log directory inside the RustFS container. Set to `""` to disable log PVCs and mounts. | | config.rustfs.region | string | `"us-east-1"` | | | config.rustfs.volumes | string | `""` | | | config.rustfs.log_rotation.size | int | `"100"` | Default log rotation size mb for rustfs. | diff --git a/helm/rustfs/templates/deployment.yaml b/helm/rustfs/templates/deployment.yaml index dfa27ac60..254a0ed27 100644 --- a/helm/rustfs/templates/deployment.yaml +++ b/helm/rustfs/templates/deployment.yaml @@ -1,4 +1,5 @@ {{- $logDir := .Values.config.rustfs.obs_log_directory }} +{{- $logDirEnabled := ne $logDir "" }} {{- if .Values.mode.standalone.enabled }} apiVersion: apps/v1 @@ -75,13 +76,18 @@ spec: - sh - -c - | - mkdir -p /data /mnt/rustfs/logs + mkdir -p /data + {{- if $logDirEnabled }} + mkdir -p /mnt/rustfs/logs chmod 755 /mnt/rustfs/logs + {{- end }} volumeMounts: - name: data mountPath: /data + {{- if $logDirEnabled }} - name: logs mountPath: /mnt/rustfs + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.rustfs.repository }}:{{ .Values.image.rustfs.tag | default .Chart.AppVersion }}" @@ -130,9 +136,11 @@ spec: {{- with .Values.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} + {{- if $logDirEnabled }} - name: logs mountPath: {{ $logDir }} subPath: logs + {{- end }} - name: data mountPath: /data volumes: @@ -161,6 +169,7 @@ spec: - key: ca.crt path: client_ca.crt {{- end }} + {{- if $logDirEnabled }} - name: logs persistentVolumeClaim: {{- if .Values.mode.standalone.existingClaim.logsClaim }} @@ -168,6 +177,7 @@ spec: {{- else }} claimName: {{ include "rustfs.fullname" $ }}-logs {{- end }} + {{- end }} - name: data persistentVolumeClaim: {{- if .Values.mode.standalone.existingClaim.dataClaim }} diff --git a/helm/rustfs/templates/pvc.yaml b/helm/rustfs/templates/pvc.yaml index a0180c025..d2ddbd95a 100644 --- a/helm/rustfs/templates/pvc.yaml +++ b/helm/rustfs/templates/pvc.yaml @@ -23,7 +23,7 @@ spec: {{- end }} {{- end }} -{{- if and .Values.mode.standalone.enabled (not .Values.mode.standalone.existingClaim.logsClaim) }} +{{- if and .Values.mode.standalone.enabled .Values.config.rustfs.obs_log_directory (not .Values.mode.standalone.existingClaim.logsClaim) }} {{- with .Values.storageclass }} --- apiVersion: v1 diff --git a/helm/rustfs/templates/statefulset.yaml b/helm/rustfs/templates/statefulset.yaml index f0e035bac..f5013169b 100644 --- a/helm/rustfs/templates/statefulset.yaml +++ b/helm/rustfs/templates/statefulset.yaml @@ -1,4 +1,5 @@ {{- $logDir := .Values.config.rustfs.obs_log_directory }} +{{- $logDirEnabled := ne $logDir "" }} {{- if .Values.mode.distributed.enabled }} --- @@ -86,8 +87,10 @@ spec: elif [ "$REPLICA_COUNT" -eq 16 ]; then mkdir -p /data fi + {{- if $logDirEnabled }} mkdir -p /mnt/rustfs/logs chmod 755 /mnt/rustfs/logs + {{- end }} volumeMounts: {{- if eq (int .Values.replicaCount) 4 }} {{- range $i := until (int .Values.replicaCount) }} @@ -98,8 +101,10 @@ spec: - name: data mountPath: /data {{- end }} + {{- if $logDirEnabled }} - name: logs mountPath: /mnt/rustfs + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.rustfs.repository }}:{{ .Values.image.rustfs.tag | default .Chart.AppVersion }}" @@ -148,9 +153,11 @@ spec: {{- with .Values.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} + {{- if $logDirEnabled }} - name: logs mountPath: {{ $logDir }} subPath: logs + {{- end }} {{- if eq (int .Values.replicaCount) 4 }} {{- range $i := until (int .Values.replicaCount) }} - name: data-rustfs-{{ $i }} @@ -189,6 +196,7 @@ spec: {{- end }} {{- end }} volumeClaimTemplates: + {{- if $logDirEnabled }} - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -203,6 +211,7 @@ spec: resources: requests: storage: {{ .Values.storageclass.logStorageSize }} + {{- end }} {{- if eq (int .Values.replicaCount) 4 }} {{- range $i := until (int .Values.replicaCount) }} - apiVersion: v1 diff --git a/helm/rustfs/values.yaml b/helm/rustfs/values.yaml index cf96194e6..6c5cd5860 100644 --- a/helm/rustfs/values.yaml +++ b/helm/rustfs/values.yaml @@ -71,7 +71,7 @@ config: console_address: ":9001" log_level: "info" region: "us-east-1" - obs_log_directory: "/logs" + obs_log_directory: "/logs" # Set to "" to disable log PVCs and mounts. obs_environment: "development" # Optionally enable support for virtual-hosted-style requests. # See more information: https://docs.rustfs.com/integration/virtual.html