diff --git a/apis/fluentbit/v1alpha2/plugins/output/forward_types.go b/apis/fluentbit/v1alpha2/plugins/output/forward_types.go index 53810f31d..38e939019 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/forward_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/forward_types.go @@ -40,7 +40,11 @@ type Forward struct { SelfHostname string `json:"selfHostname,omitempty"` // Retain metadata when forwarding in forward mode. RetainMetadataInForwardMode *bool `json:"retainMetadataInForwardMode,omitempty"` - *plugins.TLS `json:"tls,omitempty"` + // Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + // set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + // +kubebuilder:validation:Enum:=gzip + Compress string `json:"compress,omitempty"` + *plugins.TLS `json:"tls,omitempty"` // Include fluentbit networking options for this output-plugin *plugins.Networking `json:"networking,omitempty"` } @@ -78,6 +82,7 @@ func (f *Forward) Params(sl plugins.SecretLoader) (*params.KVs, error) { plugins.InsertKVString(kvs, "Tag", f.Tag) plugins.InsertKVString(kvs, "Shared_Key", f.SharedKey) plugins.InsertKVString(kvs, "Self_Hostname", f.SelfHostname) + plugins.InsertKVString(kvs, "Compress", f.Compress) plugins.InsertKVField(kvs, "Port", f.Port) plugins.InsertKVField(kvs, "Empty_Shared_Key", f.EmptySharedKey) diff --git a/apis/fluentbit/v1alpha2/plugins/output/forward_types_test.go b/apis/fluentbit/v1alpha2/plugins/output/forward_types_test.go new file mode 100644 index 000000000..78029ad4c --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/output/forward_types_test.go @@ -0,0 +1,45 @@ +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/onsi/gomega" +) + +func TestOutput_Forward_Params(t *testing.T) { + g := NewGomegaWithT(t) + + sl := plugins.NewSecretLoader(nil, "test namespace") + + fwd := Forward{ + Host: "fluentd.logging", + Port: new(int32(24224)), + Compress: "gzip", + } + + expected := params.NewKVs() + expected.Insert("Host", "fluentd.logging") + expected.Insert("Compress", "gzip") + expected.Insert("Port", "24224") + + kvs, err := fwd.Params(sl) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(kvs).To(Equal(expected)) +} + +func TestOutput_Forward_Params_NoCompress(t *testing.T) { + g := NewGomegaWithT(t) + + sl := plugins.NewSecretLoader(nil, "test namespace") + + fwd := Forward{Host: "fluentd.logging"} + + expected := params.NewKVs() + expected.Insert("Host", "fluentd.logging") + + kvs, err := fwd.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 41976750a..ebd9eced6 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 @@ -1143,6 +1143,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret. 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 95448c939..002cff96d 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 @@ -1143,6 +1143,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret. diff --git a/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml b/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml index 82b305512..5fd112752 100644 --- a/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml +++ b/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml @@ -1141,6 +1141,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret. diff --git a/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml b/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml index afd512b22..3e12af2cd 100644 --- a/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml +++ b/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml @@ -1141,6 +1141,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret. diff --git a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml index ed37759bb..10dcc1d84 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml @@ -1142,6 +1142,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret. diff --git a/config/crd/bases/fluentbit.fluent.io_outputs.yaml b/config/crd/bases/fluentbit.fluent.io_outputs.yaml index 939a3adac..d6fe5d8d8 100644 --- a/config/crd/bases/fluentbit.fluent.io_outputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_outputs.yaml @@ -1142,6 +1142,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret. diff --git a/docs/plugins/fluentbit/output/forward.md b/docs/plugins/fluentbit/output/forward.md index 603354499..245720cbf 100644 --- a/docs/plugins/fluentbit/output/forward.md +++ b/docs/plugins/fluentbit/output/forward.md @@ -17,5 +17,6 @@ Forward is the protocol used by Fluentd to route messages between peers.
| password | Specify the password corresponding to the username. | *[plugins.Secret](../secret.md) | | selfHostname | Default value of the auto-generated certificate common name (CN). | string | | retainMetadataInForwardMode | Retain metadata when forwarding in forward mode. | *bool | +| compress | Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. | string | | tls | | *[plugins.TLS](../tls.md) | | networking | Include fluentbit networking options for this output-plugin | *[plugins.Networking](../net.md) | diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 61fa9328c..5b4f163f7 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -5344,6 +5344,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret. @@ -36849,6 +36856,13 @@ spec: forward: description: Forward defines Forward Output configuration. properties: + compress: + description: |- + Set to gzip to enable gzip compression. Incompatible with timeAsInteger set to true and with tags + set dynamically using the Rewrite Tag filter. Requires Fluentd server v0.14.7 or later. + enum: + - gzip + type: string emptySharedKey: description: Use this option to connect to Fluentd with a zero-length secret.