Repository navigation
feat(fluentbit): add the kafka input - #2143
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
Add a kafka field to the ClusterInput spec for Fluent Bit's kafka input plugin, which subscribes to Kafka topics and turns each message into a record. Until now it was only usable through customPlugin. The input renders brokers, topics, group_id, client_id, format, poll_ms, poll_timeout_ms, buffer_max_size, enable_auto_commit and threaded, plus any rdkafka.* consumer property. Like the Kafka output, rdkafka properties can also be read from Secrets through rdkafkaSecrets, and a Secret value wins over a plain value for the same property. Fluent Bit refuses to start the input without brokers or topics and only accepts none or json as format, so the CRD requires brokers and topics and restricts format to those two values. Regenerate the deepcopy code, CRDs, setup.yaml and API docs, and list the input in docs/plugins/fluentbit/index.md. Fixes fluent#2142 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Adds a
kafkainput to ClusterInput, for Fluent Bit'skafkainput plugin. It subscribes to Kafka topics and turns each message into a record. Until now it was only usable throughcustomPlugin.This renders as:
The input covers
brokers,topics,groupId,clientId,format,pollMs,pollTimeoutMs,bufferMaxSize,enableAutoCommitandthreaded, plus anyrdkafka.*consumer property. It works like the Kafka output:rdkafkaSecretsreads properties such assasl.username/sasl.passwordfrom a Secret, and if a property is set in both places, the Secret value wins.Fluent Bit won't start the input without brokers (
config: no brokers defined) or topics (config: no topics specified), and it only acceptsnoneorjsonas format. The CRD therefore requiresbrokersandtopics(MinLength=1) and limitsformatto those two values. The API server rejects these mistakes before Fluent Bit ever sees the config.The deepcopy code, CRDs,
setup.yamland API docs are regenerated, and the input is listed indocs/plugins/fluentbit/index.md.Which issue(s) this PR fixes:
Fixes #2142
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.:
Testing
TestInput_Kafka_ParamsandTestInput_Kafka_ParamsOnlySetFieldscheck the rendered parameters with every field set and with only some set, including explicit0/falsevalues.TestInput_Kafka_ParamsRdkafkaSecretschecks that properties are read from a Secret, that a Secret value overrides a plain value, and that a missing key returns an error.TestClusterInputList_Load_Kafkachecks the classic and YAML output of a ClusterInput.make generate manifests docs-updateleaves no diff.make lintreports 0 issues, andgo test ./apis/... ./pkg/...passes.threaded: true) onfluent/fluent-bit:5.2.0against a single-nodeapache/kafka:3.9.1broker. The input consumed both topics. JSON payloads were parsed into maps, and a non-JSON payload was kept as a string, e.g.{"topic":"app-logs","partition":0,"offset":0,"error":null,"key":null,"payload":{"msg":"hello","level":"info"}}.This PR and #2145 (prometheus_remote_write input) each add a field next to
execWasiinInputSpec. Whichever merges second will need its generated files regenerated.