fluent-operator icon indicating copy to clipboard operation
fluent-operator copied to clipboard

bug: FluentD containerports are only opened for http and forward input plugins

Open MZerbe opened this issue 7 months ago • 1 comments

Problem

ContainerPorts for fluentd are only opened for the http and forward plugins configured in spec.globalInputs. This makes any other fluentd input plugin unuseable.

To Reproduce

apiVersion: fluentd.fluent.io/v1alpha1
kind: Fluentd
metadata:
  name: fluentd
  namespace: fluentd
  labels:
    app.kubernetes.io/name: fluentd
spec:
  globalInputs:
    - id: in_http
      http:
        bind: 0.0.0.0
        port: 9880
    - id: in_syslog
      customPlugin:
        config: |
          <source>
            @type syslog
            @id in_syslog
            tag foo
            port 5140
            bind 0.0.0.0
          </source>
...

Will create a fluentd container with ports metrics:2021,http:9880. The customPlugin port (or any other input plugins) are not being created.

Expected behavior

Container has open ports for every configured input plugin or the fluentd CRD allows to specify ports like the fluentbit CRD.

Your Environment

- Fluent Operator version: v3.3

How did you install fluent operator?

No response

Additional context

Code-References

It looks like that the containerPorts are statically coded to be only useable by the forward and http plugin.

  • https://github.com/fluent/fluent-operator/blob/master/pkg/operator/sts.go#L211
  • https://github.com/fluent/fluent-operator/blob/master/pkg/operator/sts.go#L221

Other issues which are correlated to this

  • The inputs.fluentd.fluent.io CRD is also not opening ports.

Contribution

With some guidance I am also open to make a contribution.

MZerbe avatar May 09 '25 10:05 MZerbe

with customPlugin, fluent-operator would have no idea about the plugin details. To support automatically create service for any plugin, i would suggest the following:

  • [ ] instead of using custom plugin, use a plugin can be found in this folder https://github.com/fluent/fluent-operator/tree/master/docs/plugins, or if it's not existing, add that plugin to be managed by fluent-operator.
  • [ ] add the required port and service to the operator, taking this as an example: https://github.com/fluent/fluent-operator/blob/master/pkg/operator/sts.go#L223-L247

cw-Guo avatar May 09 '25 20:05 cw-Guo