From a3b97bfe0317f3c948c7a09c42f48dce2d5a4146 Mon Sep 17 00:00:00 2001 From: Davide Calabrese Date: Wed, 23 Oct 2024 22:27:38 +0200 Subject: [PATCH] [helm] Allow setting notification.toml config (#6159) * [helm] Allow setting notification.toml config * [helm] Set notification config conditionally --- .../templates/filer-statefulset.yaml | 11 +++++++++++ .../templates/notification-configmap.yaml | 19 +++++++++++++++++++ k8s/charts/seaweedfs/values.yaml | 13 +++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 k8s/charts/seaweedfs/templates/notification-configmap.yaml diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml index 0dfa0e84e..5ac84bdf7 100644 --- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml @@ -234,6 +234,12 @@ spec: - name: data-filer mountPath: /data {{- end }} + {{- if .Values.filer.notificationConfig }} + - name: notification-config + readOnly: true + mountPath: /etc/seaweedfs/notification.toml + subPath: notification.toml + {{- end }} {{- if .Values.global.enableSecurity }} - name: security-config readOnly: true @@ -349,6 +355,11 @@ spec: secretName: seaweedfs-s3-secret {{- end }} {{- end }} + {{- if .Values.filer.notificationConfig }} + - name: notification-config + configMap: + name: {{ template "seaweedfs.name" . }}-notification-config + {{- end }} {{- if .Values.global.enableSecurity }} - name: security-config configMap: diff --git a/k8s/charts/seaweedfs/templates/notification-configmap.yaml b/k8s/charts/seaweedfs/templates/notification-configmap.yaml new file mode 100644 index 000000000..c638c8771 --- /dev/null +++ b/k8s/charts/seaweedfs/templates/notification-configmap.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.filer.enabled .Values.filer.notificationConfig }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "seaweedfs.name" . }}-notification-config + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Values.filer.annotations }} + annotations: + {{- toYaml .Values.filer.annotations | nindent 4 }} +{{- end }} +data: + notification.toml: |- + {{ .Values.filer.notificationConfig | nindent 4 }} +{{- end }} diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index a0c010b89..2150ed724 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -546,6 +546,19 @@ filer: # Disable http request, only gRpc operations are allowed disableHttp: false + # Add a custom notification.toml to configure filer notifications + # Example: + # notificationConfig: |- + # [notification.kafka] + # enabled = false + # hosts = [ + # "localhost:9092" + # ] + # topic = "seaweedfs_filer" + # offsetFile = "./last.offset" + # offsetSaveIntervalSeconds = 10 + notificationConfig: "" + # DEPRECATE: enablePVC, storage, storageClass # Consider replacing with filer.data section below instead.