diff --git a/apis/fluentbit/v1alpha2/clusterinput_types.go b/apis/fluentbit/v1alpha2/clusterinput_types.go index 5c4dd4ecb..91b92b433 100644 --- a/apis/fluentbit/v1alpha2/clusterinput_types.go +++ b/apis/fluentbit/v1alpha2/clusterinput_types.go @@ -71,6 +71,8 @@ type InputSpec struct { Syslog *input.Syslog `json:"syslog,omitempty"` // TCP defines the TCP input plugin configuration TCP *input.TCP `json:"tcp,omitempty"` + // UDP defines the UDP input plugin configuration + UDP *input.UDP `json:"udp,omitempty"` // KubernetesEvents defines the KubernetesEvents input plugin configuration KubernetesEvents *input.KubernetesEvents `json:"kubernetesEvents,omitempty"` // Processors defines the processors configuration diff --git a/apis/fluentbit/v1alpha2/plugins/input/udp.go b/apis/fluentbit/v1alpha2/plugins/input/udp.go new file mode 100644 index 000000000..af3001bd7 --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/input/udp.go @@ -0,0 +1,73 @@ +package input + +import ( + "fmt" + "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins" + "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params" +) + +// +kubebuilder:object:generate:=true + +// The udp input plugin allows to retrieve structured JSON or raw messages over a UDP network interface (UDP port). +// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/udp** + +type UDP struct { + // Listen Listener network interface, default: 0.0.0.0 + Listen *string `json:"listen,omitempty"` + // Port Specify the UDP port where listening for connections, default: 5170 + // +kubebuilder:validation:Minimum:=1 + // +kubebuilder:validation:Maximum:=65535 + Port *int32 `json:"port,omitempty"` + // BufferSize Specify the maximum buffer size in KB to receive a JSON message. + // If not set, the default size will be the value of Chunk_Size. + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + BufferSize *string `json:"bufferSize,omitempty"` + // By default the buffer to store the incoming JSON messages, do not allocate the maximum memory allowed, + // instead it allocate memory when is required. + // The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB). + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + ChunkSize *string `json:"chunkSize,omitempty"` + // Format Specify the expected payload format. It support the options json and none. + // When using json, it expects JSON maps, when is set to none, + // it will split every record using the defined Separator (option below). + Format *string `json:"format,omitempty"` + // Separator When the expected Format is set to none, Fluent Bit needs a separator string to split the records. By default it uses the breakline character (LF or 0x10). + Separator *string `json:"separator,omitempty"` + // SourceAddressKey Specify the key where the source address will be injected. + SourceAddressKey *string `json:"sourceAddressKey,omitempty"` + // Threaded mechanism allows input plugin to run in a separate thread which helps to desaturate the main pipeline. + Threaded *string `json:"threaded,omitempty"` +} + +func (_ *UDP) Name() string { + return "udp" +} + +func (u *UDP) Params(_ plugins.SecretLoader) (*params.KVs, error) { + kvs := params.NewKVs() + if u.Listen != nil { + kvs.Insert("Listen", *u.Listen) + } + if u.Port != nil { + kvs.Insert("Port", fmt.Sprint(*u.Port)) + } + if u.BufferSize != nil { + kvs.Insert("Buffer_Size", *u.BufferSize) + } + if u.ChunkSize != nil { + kvs.Insert("Chunk_Size", *u.ChunkSize) + } + if u.Format != nil { + kvs.Insert("Format", *u.Format) + } + if u.Separator != nil { + kvs.Insert("Separator", *u.Separator) + } + if u.SourceAddressKey != nil { + kvs.Insert("Source_Address_Key", *u.SourceAddressKey) + } + if u.Threaded != nil { + kvs.Insert("Threaded", *u.Threaded) + } + return kvs, nil +} diff --git a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go index f41c794cf..ad10d8aeb 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go @@ -279,6 +279,21 @@ func (in *OpenTelemetry) DeepCopy() *OpenTelemetry { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Path) DeepCopyInto(out *Path) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Path. +func (in *Path) DeepCopy() *Path { + if in == nil { + return nil + } + out := new(Path) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PrometheusScrapeMetrics) DeepCopyInto(out *PrometheusScrapeMetrics) { *out = *in @@ -448,3 +463,58 @@ func (in *Tail) DeepCopy() *Tail { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UDP) DeepCopyInto(out *UDP) { + *out = *in + if in.Listen != nil { + in, out := &in.Listen, &out.Listen + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.BufferSize != nil { + in, out := &in.BufferSize, &out.BufferSize + *out = new(string) + **out = **in + } + if in.ChunkSize != nil { + in, out := &in.ChunkSize, &out.ChunkSize + *out = new(string) + **out = **in + } + if in.Format != nil { + in, out := &in.Format, &out.Format + *out = new(string) + **out = **in + } + if in.Separator != nil { + in, out := &in.Separator, &out.Separator + *out = new(string) + **out = **in + } + if in.SourceAddressKey != nil { + in, out := &in.SourceAddressKey, &out.SourceAddressKey + *out = new(string) + **out = **in + } + if in.Threaded != nil { + in, out := &in.Threaded, &out.Threaded + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UDP. +func (in *UDP) DeepCopy() *UDP { + if in == nil { + return nil + } + out := new(UDP) + in.DeepCopyInto(out) + return out +} diff --git a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go index e7fea317c..219c95cba 100644 --- a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go @@ -1187,6 +1187,11 @@ func (in *InputSpec) DeepCopyInto(out *InputSpec) { *out = new(input.TCP) (*in).DeepCopyInto(*out) } + if in.UDP != nil { + in, out := &in.UDP, &out.UDP + *out = new(input.UDP) + (*in).DeepCopyInto(*out) + } if in.KubernetesEvents != nil { in, out := &in.KubernetesEvents, &out.KubernetesEvents *out = new(input.KubernetesEvents) diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml index fe1312286..6e0b230b4 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml @@ -826,6 +826,52 @@ spec: uses the breakline character (LF or 0x10). type: string type: object + udp: + description: UDP defines the UDP input plugin configuration + properties: + bufferSize: + description: |- + BufferSize Specify the maximum buffer size in KB to receive a JSON message. + If not set, the default size will be the value of Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + chunkSize: + description: |- + By default the buffer to store the incoming JSON messages, do not allocate the maximum memory allowed, + instead it allocate memory when is required. + The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + format: + description: |- + Format Specify the expected payload format. It support the options json and none. + When using json, it expects JSON maps, when is set to none, + it will split every record using the defined Separator (option below). + type: string + listen: + description: 'Listen Listener network interface, default: 0.0.0.0' + type: string + port: + description: 'Port Specify the UDP port where listening for connections, + default: 5170' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + separator: + description: Separator When the expected Format is set to none, + Fluent Bit needs a separator string to split the records. By + default it uses the breakline character (LF or 0x10). + type: string + sourceAddressKey: + description: SourceAddressKey Specify the key where the source + address will be injected. + type: string + threaded: + description: Threaded mechanism allows input plugin to run in + a separate thread which helps to desaturate the main pipeline. + type: string + type: object type: object type: object served: true diff --git a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml index fe1312286..6e0b230b4 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml @@ -826,6 +826,52 @@ spec: uses the breakline character (LF or 0x10). type: string type: object + udp: + description: UDP defines the UDP input plugin configuration + properties: + bufferSize: + description: |- + BufferSize Specify the maximum buffer size in KB to receive a JSON message. + If not set, the default size will be the value of Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + chunkSize: + description: |- + By default the buffer to store the incoming JSON messages, do not allocate the maximum memory allowed, + instead it allocate memory when is required. + The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + format: + description: |- + Format Specify the expected payload format. It support the options json and none. + When using json, it expects JSON maps, when is set to none, + it will split every record using the defined Separator (option below). + type: string + listen: + description: 'Listen Listener network interface, default: 0.0.0.0' + type: string + port: + description: 'Port Specify the UDP port where listening for connections, + default: 5170' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + separator: + description: Separator When the expected Format is set to none, + Fluent Bit needs a separator string to split the records. By + default it uses the breakline character (LF or 0x10). + type: string + sourceAddressKey: + description: SourceAddressKey Specify the key where the source + address will be injected. + type: string + threaded: + description: Threaded mechanism allows input plugin to run in + a separate thread which helps to desaturate the main pipeline. + type: string + type: object type: object type: object served: true diff --git a/docs/fluentbit.md b/docs/fluentbit.md index 207387bc5..62d03981e 100644 --- a/docs/fluentbit.md +++ b/docs/fluentbit.md @@ -457,6 +457,7 @@ InputSpec defines the desired state of ClusterInput | nginx | Nginx defines the Nginx input plugin configuration | *[input.Nginx](plugins/input/nginx.md) | | syslog | Syslog defines the Syslog input plugin configuration | *[input.Syslog](plugins/input/syslog.md) | | tcp | TCP defines the TCP input plugin configuration | *[input.TCP](plugins/input/tcp.md) | +| udp | UDP defines the UDP input plugin configuration | *[input.UDP](plugins/input/udp.md) | | kubernetesEvents | KubernetesEvents defines the KubernetesEvents input plugin configuration | *[input.KubernetesEvents](plugins/input/kubernetesevents.md) | | processors | Processors defines the processors configuration | *plugins.Config | diff --git a/docs/plugins/fluentbit/input/udp.md b/docs/plugins/fluentbit/input/udp.md new file mode 100644 index 000000000..1f17cf55b --- /dev/null +++ b/docs/plugins/fluentbit/input/udp.md @@ -0,0 +1,15 @@ +# UDP + + + + +| Field | Description | Scheme | +| ----- | ----------- | ------ | +| listen | Listen Listener network interface, default: 0.0.0.0 | *string | +| port | Port Specify the UDP port where listening for connections, default: 5170 | *int32 | +| bufferSize | BufferSize Specify the maximum buffer size in KB to receive a JSON message. If not set, the default size will be the value of Chunk_Size. | *string | +| chunkSize | By default the buffer to store the incoming JSON messages, do not allocate the maximum memory allowed, instead it allocate memory when is required. The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB). | *string | +| format | Format Specify the expected payload format. It support the options json and none. When using json, it expects JSON maps, when is set to none, it will split every record using the defined Separator (option below). | *string | +| separator | Separator When the expected Format is set to none, Fluent Bit needs a separator string to split the records. By default it uses the breakline character (LF or 0x10). | *string | +| sourceAddressKey | SourceAddressKey Specify the key where the source address will be injected. | *string | +| threaded | Threaded mechanism allows input plugin to run in a separate thread which helps to desaturate the main pipeline. | *string | diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index e3a536c55..d19d205c4 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -2794,6 +2794,52 @@ spec: uses the breakline character (LF or 0x10). type: string type: object + udp: + description: UDP defines the UDP input plugin configuration + properties: + bufferSize: + description: |- + BufferSize Specify the maximum buffer size in KB to receive a JSON message. + If not set, the default size will be the value of Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + chunkSize: + description: |- + By default the buffer to store the incoming JSON messages, do not allocate the maximum memory allowed, + instead it allocate memory when is required. + The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + format: + description: |- + Format Specify the expected payload format. It support the options json and none. + When using json, it expects JSON maps, when is set to none, + it will split every record using the defined Separator (option below). + type: string + listen: + description: 'Listen Listener network interface, default: 0.0.0.0' + type: string + port: + description: 'Port Specify the UDP port where listening for connections, + default: 5170' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + separator: + description: Separator When the expected Format is set to none, + Fluent Bit needs a separator string to split the records. By + default it uses the breakline character (LF or 0x10). + type: string + sourceAddressKey: + description: SourceAddressKey Specify the key where the source + address will be injected. + type: string + threaded: + description: Threaded mechanism allows input plugin to run in + a separate thread which helps to desaturate the main pipeline. + type: string + type: object type: object type: object served: true diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index f4942361d..ba19c84a2 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -2794,6 +2794,52 @@ spec: uses the breakline character (LF or 0x10). type: string type: object + udp: + description: UDP defines the UDP input plugin configuration + properties: + bufferSize: + description: |- + BufferSize Specify the maximum buffer size in KB to receive a JSON message. + If not set, the default size will be the value of Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + chunkSize: + description: |- + By default the buffer to store the incoming JSON messages, do not allocate the maximum memory allowed, + instead it allocate memory when is required. + The rounds of allocations are set by Chunk_Size in KB. If not set, Chunk_Size is equal to 32 (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + format: + description: |- + Format Specify the expected payload format. It support the options json and none. + When using json, it expects JSON maps, when is set to none, + it will split every record using the defined Separator (option below). + type: string + listen: + description: 'Listen Listener network interface, default: 0.0.0.0' + type: string + port: + description: 'Port Specify the UDP port where listening for connections, + default: 5170' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + separator: + description: Separator When the expected Format is set to none, + Fluent Bit needs a separator string to split the records. By + default it uses the breakline character (LF or 0x10). + type: string + sourceAddressKey: + description: SourceAddressKey Specify the key where the source + address will be injected. + type: string + threaded: + description: Threaded mechanism allows input plugin to run in + a separate thread which helps to desaturate the main pipeline. + type: string + type: object type: object type: object served: true @@ -39243,6 +39289,26 @@ rules: - get - watch - patch +- apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + verbs: + - create + - list + - get + - watch + - patch +- apiGroups: + - rbac.authorization.k8s.io + resources: + - roles + verbs: + - create + - list + - get + - watch + - patch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding