From d173d78580cdcc51ac7aa86c84feb0356bd8ab04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geir=20R=C3=A5ness?= <11741725+geirra@users.noreply.github.com> Date: Thu, 2 Jul 2026 08:47:50 +0200 Subject: [PATCH] support for totalLimitSize in splunk output --- .../v1alpha2/plugins/output/splunk_types.go | 4 ++ .../plugins/output/splunk_types_test.go | 42 +++++++++++++++++++ .../fluentbit.fluent.io_clusteroutputs.yaml | 4 ++ .../fluentbit.fluent.io_outputs.yaml | 4 ++ .../fluentbit.fluent.io_clusteroutputs.yaml | 4 ++ .../crds/fluentbit.fluent.io_outputs.yaml | 4 ++ .../fluentbit.fluent.io_clusteroutputs.yaml | 4 ++ .../bases/fluentbit.fluent.io_outputs.yaml | 4 ++ docs/plugins/fluentbit/output/splunk.md | 1 + manifests/setup/setup.yaml | 8 ++++ 10 files changed, 79 insertions(+) create mode 100644 apis/fluentbit/v1alpha2/plugins/output/splunk_types_test.go diff --git a/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go b/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go index 56075a22e..9d63cea52 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/splunk_types.go @@ -61,6 +61,8 @@ type Splunk struct { *plugins.TLS `json:"tls,omitempty"` // Include fluentbit networking options for this output-plugin *plugins.Networking `json:"networking,omitempty"` + // Limit the maximum number of Chunks in the filesystem for the current output logical destination. + TotalLimitSize string `json:"totalLimitSize,omitempty"` } // Name implement Section() method @@ -119,5 +121,7 @@ func (o *Splunk) Params(sl plugins.SecretLoader) (*params.KVs, error) { } } + plugins.InsertKVString(kvs, "storage.total_limit_size", o.TotalLimitSize) + return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/splunk_types_test.go b/apis/fluentbit/v1alpha2/plugins/output/splunk_types_test.go new file mode 100644 index 000000000..b4fb90396 --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/output/splunk_types_test.go @@ -0,0 +1,42 @@ +package output + +import ( + "testing" + + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" + "github.com/fluent/fluent-operator/v3/pkg/utils" + . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client/fake" +) + +func TestSplunk_Params(t *testing.T) { + g := NewGomegaWithT(t) + fcb := fake.ClientBuilder{} + fc := fcb.WithObjects(&v1.Secret{ + ObjectMeta: metav1.ObjectMeta{Namespace: "test_namespace", Name: "splunk_secret"}, + Data: map[string][]byte{ + "splunk_token": []byte("expected_splunk_token"), + }, + }).Build() + + sl := plugins.NewSecretLoader(fc, "test_namespace") + s := Splunk{ + Host: "splunk.example.com", + Port: utils.ToPtr[int32](8088), + SplunkToken: &plugins.Secret{ValueFrom: plugins.ValueSource{SecretKeyRef: v1.SecretKeySelector{LocalObjectReference: v1.LocalObjectReference{Name: "splunk_secret"}, Key: "splunk_token"}}}, + TotalLimitSize: "512M", + } + + expected := params.NewKVs() + expected.Insert("splunk_token", "expected_splunk_token") + expected.Insert("host", "splunk.example.com") + expected.Insert("port", "8088") + expected.Insert("storage.total_limit_size", "512M") + + kvs, err := s.Params(sl) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(kvs).To(Equal(expected)) +} diff --git a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml index 214a9c96b..f3a450921 100644 --- a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml +++ b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml @@ -4380,6 +4380,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration diff --git a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml index 76088d713..2e0d913b7 100644 --- a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml +++ b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml @@ -4380,6 +4380,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration diff --git a/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml b/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml index 2abf993df..e5a40e957 100644 --- a/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml +++ b/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml @@ -4378,6 +4378,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration diff --git a/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml b/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml index dcee8f101..ce44446df 100644 --- a/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml +++ b/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml @@ -4378,6 +4378,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration diff --git a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml index 8841ee8f2..e00ea6581 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml @@ -4379,6 +4379,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration diff --git a/config/crd/bases/fluentbit.fluent.io_outputs.yaml b/config/crd/bases/fluentbit.fluent.io_outputs.yaml index 34c4f25fa..20b22d143 100644 --- a/config/crd/bases/fluentbit.fluent.io_outputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_outputs.yaml @@ -4379,6 +4379,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration diff --git a/docs/plugins/fluentbit/output/splunk.md b/docs/plugins/fluentbit/output/splunk.md index 8594e60bb..401176ab3 100644 --- a/docs/plugins/fluentbit/output/splunk.md +++ b/docs/plugins/fluentbit/output/splunk.md @@ -26,3 +26,4 @@ Splunk output plugin allows to ingest your records into a Splunk Enterprise serv | Workers | Enables dedicated thread(s) for this output. Default value `2` is set since version 1.8.13. For previous versions is 0. | *int32 | | tls | | *[plugins.TLS](../tls.md) | | networking | Include fluentbit networking options for this output-plugin | *[plugins.Networking](../net.md) | +| totalLimitSize | Limit the maximum number of Chunks in the filesystem for the current output logical destination. | string | diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index fa044f4a2..436e3e5d1 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -8579,6 +8579,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration @@ -39245,6 +39249,10 @@ spec: description: Hostname to be used for TLS SNI extension type: string type: object + totalLimitSize: + description: Limit the maximum number of Chunks in the filesystem + for the current output logical destination. + type: string type: object stackdriver: description: Stackdriver defines Stackdriver Output Configuration