fluent / fluent/fluent-operator

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

Open
#1,833 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
682
Forks
328
Avg merge
2d 23h
Merged PRs (30d)
13

Description

### Describe the issue

The current operator code does not allow setting multiple forward or http inputs inside a single Fluentd sts, since the name conflicts.
Specifically the issue seems to be [here](https://github.com/fluent/fluent-operator/blob/master/pkg/operator/sts.go#L182):
```
ports = append(ports, corev1.ContainerPort{
Name: DefaultForwardName,
ContainerPort: forwardPort,
Protocol: corev1.ProtocolTCP,
})
```
Since `DefaultForwardName` is harcoded, the operator has the error `"StatefulSet.apps \"fluentd\" is invalid: spec.template.spec.containers[0].ports[2].name: Duplicate value: \"forward\""`.

### To Reproduce

Set the `globalInputs` inside the Fluentd like so:
```
globalInputs:
- forward:
bind: 0.0.0.0
port: 24224
addTagPrefix: alpha
- forward:
bind: 0.0.0.0
port: 25224
addTagPrefix: beta
```

### Expected behavior

Its expected that the operator will allow multiple `http` / `forward` inputs on different ports.

The simple solution can be adding the port number to the port name as a suffix, for example, forward-25224. ([also for the Service created](https://github.com/fluent/fluent-operator/blob/master/pkg/operator/fluentd-service.go#L16)).
This can be a breaking change depending on the user implementation, and might be mitigated by keeping the name the same if `http` / `forward` exists only once.

### Your Environment

```markdown
- Fluent Operator version: 3.5.0
```

### Workaround

The workaround is to create a separate Fluentd deployment for the new pipeline, or find another way to differentiate the records other than the input port.

### How did you install fluent operator?

helm

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.