-
Notifications
You must be signed in to change notification settings - Fork 1.8k
in_kubernetes_events: add support for configuring input upstream network setup #11188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAdded an upstream-binding validation step in the Kubernetes events plugin's network initialization: after creating the upstream context the code calls Changes
Sequence Diagram(s)sequenceDiagram
participant Input as flb_input
participant Init as network_init()
participant Upstr as create_upstream()
participant Bind as flb_input_upstream_set()
Input->>Init: call network_init()
Init->>Upstr: create upstream context
Upstr-->>Init: upstream created
Init->>Bind: flb_input_upstream_set(upstream, ins)
alt bind succeeds
Bind-->>Init: success
Init-->>Input: return success
else bind fails
Bind-->>Init: error
Init->>Upstr: flb_upstream_destroy(upstream)
Init->>Init: ctx->upstream = NULL
Init-->>Input: return -1 (error)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)plugins/in_kubernetes_events/kubernetes_events_conf.c (2)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
plugins/in_kubernetes_events/kubernetes_events_conf.c(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
plugins/in_kubernetes_events/kubernetes_events_conf.c (2)
src/flb_input.c (1)
flb_input_upstream_set(2207-2226)src/flb_upstream.c (1)
flb_upstream_destroy(656-698)
🔇 Additional comments (1)
plugins/in_kubernetes_events/kubernetes_events_conf.c (1)
131-136: LGTM! Proper network setup propagation with correct error handling.The addition of
flb_input_upstream_setcorrectly propagates the input instance's network configuration (net_setup) to the upstream connection, which aligns with the PR objective. The error handling properly cleans up resources by destroying the upstream and setting it to NULL before returning.
…ork setup - pass the input net_setup into network_init to reuse configured options - apply flb_input_upstream_set so the upstream inherits the input context
dbe85c1 to
6f6498f
Compare
related stale PR (#10487)
Enable support for network setup parameters (like keepalive, timeouts) to be applied to the upstream connection in the Kubernetes events plugin. The network_init function now accepts and copies the input instance's net_setup configuration to the upstream, allowing proper TCP keepalive and timeout configuration.
Fixes Kubernetes events plugin failing to reconnect when an API server control plane node fails. The plugin uses long-lived watch streams to receive events, which can become stale when the underlying control plane node stops responding. The fix propagates network configuration settings (TCP keepalive, connection recycling, timeouts) from the input plugin to the upstream connection, enabling proper detection of dead connections and automatic reconnection to healthy control plane nodes.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
Example configuration file for the change:
Setup with 3CP apiserver endpoints
Initially, fluent-bit connects to the 10.0.0.6 (via LB), once the apiserver fails/crashes/shutdowns, the conenction remains established but its stale
FB logs
Connection trace
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.