diff --git a/apis/fluentbit/v1alpha2/clusterinput_types.go b/apis/fluentbit/v1alpha2/clusterinput_types.go index 405eb12e7..dbe3f0fe9 100644 --- a/apis/fluentbit/v1alpha2/clusterinput_types.go +++ b/apis/fluentbit/v1alpha2/clusterinput_types.go @@ -57,6 +57,8 @@ type InputSpec struct { Forward *input.Forward `json:"forward,omitempty"` // OpenTelemetry defines forward input plugin configuration OpenTelemetry *input.OpenTelemetry `json:"openTelemetry,omitempty"` + // HTTP defines forward input plugin configuration + HTTP *input.HTTP `json:"http,omitempty"` } // +kubebuilder:object:root=true diff --git a/apis/fluentbit/v1alpha2/plugins/input/http.go b/apis/fluentbit/v1alpha2/plugins/input/http.go new file mode 100644 index 000000000..9348bc44b --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/input/http.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 HTTP input plugin allows you to send custom records to an HTTP endpoint. +// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/http** +type HTTP struct { + // The address to listen on,default 0.0.0.0 + Listen string `json:"listen,omitempty"` + // The port for Fluent Bit to listen on,default 9880 + // +kubebuilder:validation:Minimum:=1 + // +kubebuilder:validation:Maximum:=65535 + Port *int32 `json:"port,omitempty"` + // Specify the key name to overwrite a tag. If set, the tag will be overwritten by a value of the key. + Tagkey string `json:"tagKey,omitempty"` + // Specify the maximum buffer size in KB to receive a JSON message,default 4M. + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + BufferMaxSize string `json:"bufferMaxSize,omitempty"` + // This sets the chunk size for incoming incoming JSON messages. + //These chunks are then stored/managed in the space available by buffer_max_size,default 512K. + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + BufferChunkSize string `json:"bufferChunkSize,omitempty"` + // It allows to set successful response code. 200, 201 and 204 are supported,default 201. + SuccessfulResponseCode *int32 `json:"successfulResponseCode,omitempty"` + // Add an HTTP header key/value pair on success. Multiple headers can be set. Example: X-Custom custom-answer. + SuccessfulHeader string `json:"successfulHeader,omitempty"` + *plugins.TLS `json:"tls,omitempty"` +} + +func (_ *HTTP) Name() string { + return "http" +} + +// Params implement Section() method +func (h *HTTP) Params(sl plugins.SecretLoader) (*params.KVs, error) { + kvs := params.NewKVs() + if h.Listen != "" { + kvs.Insert("listen", h.Listen) + } + if h.Port != nil { + kvs.Insert("port", fmt.Sprint(*h.Port)) + } + if h.Tagkey != "" { + kvs.Insert("tag_key", h.Tagkey) + } + if h.BufferMaxSize != "" { + kvs.Insert("buffer_max_size", h.BufferMaxSize) + } + if h.BufferChunkSize != "" { + kvs.Insert("buffer_chunk_size", h.BufferChunkSize) + } + if h.SuccessfulResponseCode != nil { + kvs.Insert("successful_response_code", fmt.Sprint(*h.SuccessfulResponseCode)) + } + if h.SuccessfulHeader != "" { + kvs.Insert("success_header", h.SuccessfulHeader) + } + if h.TLS != nil { + tls, err := h.TLS.Params(sl) + if err != nil { + return nil, err + } + kvs.Merge(tls) + } + 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 6652b1d30..4d676498c 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go @@ -21,7 +21,9 @@ limitations under the License. package input -import () +import ( + "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins" +) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Dummy) DeepCopyInto(out *Dummy) { @@ -88,6 +90,36 @@ func (in *Forward) DeepCopy() *Forward { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTP) DeepCopyInto(out *HTTP) { + *out = *in + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.SuccessfulResponseCode != nil { + in, out := &in.SuccessfulResponseCode, &out.SuccessfulResponseCode + *out = new(int32) + **out = **in + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(plugins.TLS) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTP. +func (in *HTTP) DeepCopy() *HTTP { + if in == nil { + return nil + } + out := new(HTTP) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeExporterMetrics) DeepCopyInto(out *NodeExporterMetrics) { *out = *in diff --git a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go index f333b604d..0f4033b6a 100644 --- a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go @@ -1083,6 +1083,11 @@ func (in *InputSpec) DeepCopyInto(out *InputSpec) { *out = new(input.OpenTelemetry) (*in).DeepCopyInto(*out) } + if in.HTTP != nil { + in, out := &in.HTTP, &out.HTTP + *out = new(input.HTTP) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputSpec. 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 cc45a50b3..ed29b3526 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 @@ -123,6 +123,110 @@ spec: description: Set the permission of unix socket file. type: string type: object + http: + description: HTTP defines forward input plugin configuration + properties: + bufferChunkSize: + description: This sets the chunk size for incoming incoming JSON + messages. These chunks are then stored/managed in the space + available by buffer_max_size,default 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size in KB to receive + a JSON message,default 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on,default 0.0.0.0 + type: string + port: + description: The port for Fluent Bit to listen on,default 9880 + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulHeader: + description: 'Add an HTTP header key/value pair on success. Multiple + headers can be set. Example: X-Custom custom-answer.' + type: string + successfulResponseCode: + description: It allows to set successful response code. 200, 201 + and 204 are supported,default 201. + format: int32 + type: integer + tagKey: + description: Specify the key name to overwrite a tag. If set, + the tag will be overwritten by a value of the key. + type: string + tls: + description: Fluent Bit provides integrated support for Transport + Layer Security (TLS) and it predecessor Secure Sockets Layer + (SSL) respectively. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: 'Set TLS debug verbosity level. It accept the + following values: 0 (No debug), 1 (Error), 2 (State change), + 3 (Informational) and 4 Verbose' + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + type: object logLevel: enum: - "off" diff --git a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml index cc45a50b3..ed29b3526 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml @@ -123,6 +123,110 @@ spec: description: Set the permission of unix socket file. type: string type: object + http: + description: HTTP defines forward input plugin configuration + properties: + bufferChunkSize: + description: This sets the chunk size for incoming incoming JSON + messages. These chunks are then stored/managed in the space + available by buffer_max_size,default 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size in KB to receive + a JSON message,default 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on,default 0.0.0.0 + type: string + port: + description: The port for Fluent Bit to listen on,default 9880 + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulHeader: + description: 'Add an HTTP header key/value pair on success. Multiple + headers can be set. Example: X-Custom custom-answer.' + type: string + successfulResponseCode: + description: It allows to set successful response code. 200, 201 + and 204 are supported,default 201. + format: int32 + type: integer + tagKey: + description: Specify the key name to overwrite a tag. If set, + the tag will be overwritten by a value of the key. + type: string + tls: + description: Fluent Bit provides integrated support for Transport + Layer Security (TLS) and it predecessor Secure Sockets Layer + (SSL) respectively. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: 'Set TLS debug verbosity level. It accept the + following values: 0 (No debug), 1 (Error), 2 (State change), + 3 (Informational) and 4 Verbose' + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + type: object logLevel: enum: - "off" diff --git a/docs/fluentbit.md b/docs/fluentbit.md index 70dd2e563..4c6ace504 100644 --- a/docs/fluentbit.md +++ b/docs/fluentbit.md @@ -420,6 +420,7 @@ InputSpec defines the desired state of ClusterInput | customPlugin | CustomPlugin defines Custom Input configuration. | *custom.CustomPlugin | | forward | Forward defines forward input plugin configuration | *[input.Forward](plugins/input/forward.md) | | openTelemetry | OpenTelemetry defines forward input plugin configuration | *[input.OpenTelemetry](plugins/input/opentelemetry.md) | +| http | HTTP defines forward input plugin configuration | *[input.OpenTelemetry](plugins/input/opentelemetry.md) | [Back to TOC](#table-of-contents) # NamespacedFluentBitCfgSpec diff --git a/docs/plugins/fluentbit/input/http.md b/docs/plugins/fluentbit/input/http.md new file mode 100644 index 000000000..4d8387e23 --- /dev/null +++ b/docs/plugins/fluentbit/input/http.md @@ -0,0 +1,15 @@ +# HTTP + +The HTTP input plugin allows you to send custom records to an HTTP endpoint. **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/http** + + +| Field | Description | Scheme | +| ----- | ----------- | ------ | +| listen | The address to listen on,default 0.0.0.0 | string | +| port | The port for Fluent Bit to listen on,default 9880 | *int32 | +| tagKey | Specify the key name to overwrite a tag. If set, the tag will be overwritten by a value of the key. | string | +| bufferMaxSize | Specify the maximum buffer size in KB to receive a JSON message,default 4M. | string | +| bufferChunkSize | This sets the chunk size for incoming incoming JSON messages. These chunks are then stored/managed in the space available by buffer_max_size,default 512K. | string | +| successfulResponseCode | It allows to set successful response code. 200, 201 and 204 are supported,default 201. | *int32 | +| successfulHeader | Add an HTTP header key/value pair on success. Multiple headers can be set. Example: X-Custom custom-answer. | string | +| tls | | *[plugins.TLS](../tls.md) | diff --git a/docs/plugins/fluentbit/output/azure_blob.md b/docs/plugins/fluentbit/output/azure_blob.md index 4b808977b..9d97c2462 100644 --- a/docs/plugins/fluentbit/output/azure_blob.md +++ b/docs/plugins/fluentbit/output/azure_blob.md @@ -9,8 +9,8 @@ Azure Blob is the Azure Blob output plugin, allows to ingest your records into A | sharedKey | Specify the Azure Storage Shared Key to authenticate against the storage account | *[plugins.Secret](../secret.md) | | containerName | Name of the container that will contain the blobs | string | | blobType | Specify the desired blob type. Must be `appendblob` or `blockblob` | string | -| autoCreateContainer | Creates container if ContainerName is not set. | *bool | +| autoCreateContainer | Creates container if ContainerName is not set. | string | | path | Optional path to store the blobs. | string | -| emulatorMode | Optional toggle to use an Azure emulator | *bool | +| emulatorMode | Optional toggle to use an Azure emulator | string | | endpoint | HTTP Service of the endpoint (if using EmulatorMode) | string | -| tls | Enable/Disable TLS Encryption. Azure services require TLS to be enabled. | *bool | +| tls | Enable/Disable TLS Encryption. Azure services require TLS to be enabled. | *[plugins.TLS](../tls.md) | diff --git a/gitignore b/gitignore new file mode 100644 index 000000000..e43b0f988 --- /dev/null +++ b/gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index 300d42f11..bde8e6ab9 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -1872,6 +1872,110 @@ spec: description: Set the permission of unix socket file. type: string type: object + http: + description: HTTP defines forward input plugin configuration + properties: + bufferChunkSize: + description: This sets the chunk size for incoming incoming JSON + messages. These chunks are then stored/managed in the space + available by buffer_max_size,default 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size in KB to receive + a JSON message,default 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on,default 0.0.0.0 + type: string + port: + description: The port for Fluent Bit to listen on,default 9880 + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulHeader: + description: 'Add an HTTP header key/value pair on success. Multiple + headers can be set. Example: X-Custom custom-answer.' + type: string + successfulResponseCode: + description: It allows to set successful response code. 200, 201 + and 204 are supported,default 201. + format: int32 + type: integer + tagKey: + description: Specify the key name to overwrite a tag. If set, + the tag will be overwritten by a value of the key. + type: string + tls: + description: Fluent Bit provides integrated support for Transport + Layer Security (TLS) and it predecessor Secure Sockets Layer + (SSL) respectively. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: 'Set TLS debug verbosity level. It accept the + following values: 0 (No debug), 1 (Error), 2 (State change), + 3 (Informational) and 4 Verbose' + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + type: object logLevel: enum: - "off" diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 5a229ea7a..849f9b498 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -1872,6 +1872,110 @@ spec: description: Set the permission of unix socket file. type: string type: object + http: + description: HTTP defines forward input plugin configuration + properties: + bufferChunkSize: + description: This sets the chunk size for incoming incoming JSON + messages. These chunks are then stored/managed in the space + available by buffer_max_size,default 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size in KB to receive + a JSON message,default 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on,default 0.0.0.0 + type: string + port: + description: The port for Fluent Bit to listen on,default 9880 + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulHeader: + description: 'Add an HTTP header key/value pair on success. Multiple + headers can be set. Example: X-Custom custom-answer.' + type: string + successfulResponseCode: + description: It allows to set successful response code. 200, 201 + and 204 are supported,default 201. + format: int32 + type: integer + tagKey: + description: Specify the key name to overwrite a tag. If set, + the tag will be overwritten by a value of the key. + type: string + tls: + description: Fluent Bit provides integrated support for Transport + Layer Security (TLS) and it predecessor Secure Sockets Layer + (SSL) respectively. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: 'Set TLS debug verbosity level. It accept the + following values: 0 (No debug), 1 (Error), 2 (State change), + 3 (Informational) and 4 Verbose' + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + type: object logLevel: enum: - "off"