Repository navigation
fix(fluentd): use Fluentd's default ports for inputs without a port - #2089
Merged
joshuabaird merged 4 commits intoOct 30, 2026
Merged
Conversation
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
joshuabaird
previously approved these changes
Oct 30, 2026
joshuabaird
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the fix and for adding a test that covers both bugs.
A couple of small nits, none blocking:
- The repo uses Go 1.26's
new(int32(...))elsewhere (e.g.controllers/collector_config_test.go), so theint32Ptrhelper could be dropped in favor of that. - The "http without a port" test case is on one line while the others are multi-line.
Separately, monitorAgent inputs also have an optional port that isn't exposed on the container or Service. Out of scope here, but might be worth a follow-up issue.
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Contributor
Author
|
Thanks! Both nits are done in d158fb3: the tests use Good point about |
joshuabaird
approved these changes
Oct 30, 2026
joshuabaird
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the quick turnaround, LGTM.
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:
Fixes two problems with Fluentd
globalInputsthat leaveportunset, which the API documents as allowed ("default is 24224" / "default is 9880"):DefaultForwardPortwas24424, but Fluentd'sin_forwardlistens on24224when no port is rendered (the field doc says 24224 too). Aforwardinput without a port got a container port and a Service port of 24424, while Fluentd listened on 24224, so the Service sent traffic to a port nothing listened on. The constant is now24224.MakeFluentdService. It dereferenced*input.Forward.Portand*input.Http.Portwithout a nil check, so aforwardorhttpinput without a port panicked while the Service was built. The StatefulSet/DaemonSet side (makeFluentdPorts) already handled nil. The Service now uses the same logic.For example, this panicked the reconcile before, and now produces a
forwardcontainer port and a Service port of 24224:Which issue(s) this PR fixes:
None filed. I found this while looking at the port handling for #1610.
Does this PR introduced a user-facing change?
Notes
Anyone who relied on 24424 must have set the port explicitly, because Fluentd itself never listened there. Explicit ports are unchanged.
I added
pkg/operator/fluentd_service_test.go, which checks the container port and the Service port for forward and http inputs, with and without a port. Against master it fails: it gets 24424 for forward, then panics on the http case withinvalid memory address or nil pointer dereference. With this changego test ./pkg/operator/passes, andgo vetandgofmtare clean (golang:1.26 container). I haven't run it against a live cluster.