Skip to content

feat: add support for multiple forward and http in globaInputs#1867

Open
ben-dov wants to merge 3 commits intofluent:masterfrom
ben-dov:master
Open

feat: add support for multiple forward and http in globaInputs#1867
ben-dov wants to merge 3 commits intofluent:masterfrom
ben-dov:master

Conversation

@ben-dov
Copy link
Copy Markdown
Contributor

@ben-dov ben-dov commented Feb 12, 2026

What this PR does / why we need it:

There are cases were we would like to add several forward or http global inputs to the same fluent deployment.
for example, separate processing logic depending on tag prefix.

Which issue(s) this PR fixes:

Fixes #1833

Does this PR introduced a user-facing change?

Added support for multiple forward and http in globaInputs.

Additional information

The PR does not include an breaking changes, since the first iteration of forward/http port name stays the same in the container and service of fluentd. The code can be further simplified by removing the backward compatibility logic.

@joshuabaird
Copy link
Copy Markdown
Collaborator

@ben-dov Thanks for the PR! Would you please add some tests for this functionality? I realize tests didn't exist prior to this PR, but we're trying to improve our testing coverage.

@ben-dov
Copy link
Copy Markdown
Contributor Author

ben-dov commented Feb 15, 2026

hey @joshuabaird,
Since there is already an end to end flunetd test, what sort of testing are you looking for?
I am new to GO, so will not be able to make any big change soon

ben-dov added 3 commits April 16, 2026 23:05
Signed-off-by: ben-dov <ben.d@claroty.com>
Signed-off-by: ben-dov <ben.d@claroty.com>
Signed-off-by: ben-dov <ben.d@claroty.com>
Copilot AI review requested due to automatic review settings April 16, 2026 21:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support in the Fluentd Kubernetes resources generated by Fluent Operator to expose multiple forward and http globalInputs in a single Fluentd deployment, avoiding Kubernetes port name collisions while keeping the first port name backward-compatible.

Changes:

  • Update Fluentd container port generation to suffix non-first forward/http port names with the port number (e.g., forward-25224).
  • Update Fluentd Service port generation to use the same naming scheme and target the corresponding named container ports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/operator/sts.go Generates unique container port names for multiple forward/http global inputs (keeps first as forward/http).
pkg/operator/fluentd-service.go Generates unique Service port names/TargetPorts matching the container port names for multiple forward/http global inputs.

Comment on lines 77 to 81
if input.Http != nil {
httpPort := *input.Http.Port
if httpPort == 0 {
httpPort = DefaultHttpPort
}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input.Http.Port is optional (omitempty). Dereferencing it directly can panic when port is omitted. Please align with makeFluentdPorts by nil-checking and applying DefaultHttpPort when unset (and/or keep the 0 check if you want to be defensive).

Copilot uses AI. Check for mistakes.
Comment on lines 56 to 60
@@ -60,28 +59,38 @@
forwardPort = DefaultForwardPort
}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input.Forward.Port is an optional pointer in the API (omitempty). Dereferencing it directly can panic when the user omits port, and it also makes the defaulting behavior inconsistent with makeFluentdPorts (which checks for nil). Consider using the same nil-check + default logic here before building forwardName/ServicePort.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Fluentd sts does not support multiple forward or http in the globalInputs

3 participants