From 25506ac8e52a16844b191e237ebb955dd1d5584d Mon Sep 17 00:00:00 2001 From: Dylan Jenik Date: Tue, 7 Jul 2026 21:31:17 -0400 Subject: [PATCH] feat: adjust fluentbit `service` helm value to allow specifying all possible service fields Signed-off-by: Dylan Jenik --- charts/fluent-operator/templates/_helpers.tpl | 12 ++++++++++++ .../fluentbitconfig-fluentBitConfig.yaml | 16 +++------------- .../fluentbitconfig-fluentbitconfig-edge.yaml | 9 ++------- charts/fluent-operator/values.yaml | 18 ++++++++---------- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/charts/fluent-operator/templates/_helpers.tpl b/charts/fluent-operator/templates/_helpers.tpl index 2eb9c59d0..eac2662c6 100644 --- a/charts/fluent-operator/templates/_helpers.tpl +++ b/charts/fluent-operator/templates/_helpers.tpl @@ -94,3 +94,15 @@ Determine the container log path based on containerRuntime /var/log/containers {{- end -}} {{- end }} + +{{/* +Render a ClusterFluentBitConfig `service` section, merging the caller-provided +defaults with the `fluentbit.service` value (which takes precedence on conflicts). +Expects a dict with: + defaults - dict of default service fields + root - the root template context (e.g. `$`) +*/}} +{{- define "fluent-operator.fluentbitService" -}} +{{- $merged := mergeOverwrite (deepCopy .defaults) (.root.Values.fluentbit.service | default dict) -}} +{{- toYaml $merged -}} +{{- end }} diff --git a/charts/fluent-operator/templates/fluentbitconfig-fluentBitConfig.yaml b/charts/fluent-operator/templates/fluentbitconfig-fluentBitConfig.yaml index a6940ae63..cc36f0227 100644 --- a/charts/fluent-operator/templates/fluentbitconfig-fluentBitConfig.yaml +++ b/charts/fluent-operator/templates/fluentbitconfig-fluentBitConfig.yaml @@ -12,21 +12,11 @@ spec: {{- end }} configFileFormat: {{ .Values.fluentbit.configFileFormat | default "classic" | quote }} service: - parsersFile: /fluent-bit/etc/parsers.conf - httpServer: true + {{- $defaults := dict "parsersFile" "/fluent-bit/etc/parsers.conf" "httpServer" true }} {{- with .Values.fluentbit.logLevel }} - logLevel: {{ . | quote }} - {{- end }} - {{- with .Values.fluentbit.service.storage }} - storage: - {{- toYaml . | nindent 6 }} - {{- end }} - {{- with .Values.fluentbit.service.schedulerBase }} - schedulerBase: {{ . }} - {{- end }} - {{- with .Values.fluentbit.service.schedulerCap }} - schedulerCap: {{ . }} + {{- $defaults = set $defaults "logLevel" . }} {{- end }} + {{- include "fluent-operator.fluentbitService" (dict "defaults" $defaults "root" $) | nindent 4 }} inputSelector: matchLabels: fluentbit.fluent.io/enabled: "true" diff --git a/charts/fluent-operator/templates/fluentbitconfig-fluentbitconfig-edge.yaml b/charts/fluent-operator/templates/fluentbitconfig-fluentbitconfig-edge.yaml index 7e83444fd..3f9d5dae4 100644 --- a/charts/fluent-operator/templates/fluentbitconfig-fluentbitconfig-edge.yaml +++ b/charts/fluent-operator/templates/fluentbitconfig-fluentbitconfig-edge.yaml @@ -8,13 +8,8 @@ metadata: spec: configFileFormat: {{ .Values.fluentbit.configFileFormat | default "classic" | quote }} service: - parsersFile: parsers.conf - {{- with .Values.fluentbit.service.schedulerBase }} - schedulerBase: {{ . }} - {{- end }} - {{- with .Values.fluentbit.service.schedulerCap }} - schedulerCap: {{ . }} - {{- end }} + {{- $defaults := dict "parsersFile" "parsers.conf" }} + {{- include "fluent-operator.fluentbitService" (dict "defaults" $defaults "root" $) | nindent 4 }} inputSelector: matchLabels: fluentbit.fluent.io/enabled: "true" diff --git a/charts/fluent-operator/values.yaml b/charts/fluent-operator/values.yaml index 4c943b345..7db35433f 100644 --- a/charts/fluent-operator/values.yaml +++ b/charts/fluent-operator/values.yaml @@ -530,16 +530,14 @@ fluentbit: # -- Scheduler cap for maximum retry time (seconds) # schedulerCap: 2000 # -- Storage configuration for Fluent Bit buffering - storage: {} - # Remove the above storage section and uncomment below section if you want to configure file-system as storage for buffer - # storage: - # path: "/host/fluent-bit-buffer/" - # backlogMemLimit: "50MB" - # checksum: "off" - # deleteIrrecoverableChunks: "on" - # maxChunksUp: 128 - # metrics: "on" - # sync: normal + # storage: + # path: "/host/fluent-bit-buffer/" + # backlogMemLimit: "50MB" + # checksum: "off" + # deleteIrrecoverableChunks: "on" + # maxChunksUp: 128 + # metrics: "on" + # sync: normal # Configure the default filters in FluentBit. # The `filter` will filter and parse the collected log information and output the logs into a uniform format. You can choose whether to turn this on or not.