Skip to content
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

feat: add ability to customize metrics port #587

Merged
merged 2 commits into from Feb 27, 2023

Conversation

dh185221
Copy link
Contributor

What this PR does / why we need it:

This change allows a user to specify a metrics port as part of their FluentBit custom resource. This is useful for those who need to use a port other than 2020.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduced a user-facing change?

Added the optional `metricsPort` property in the `FluentBit` custom resource allowing users to specify a port.  Port 2020 will be used by default if this property is not set.

Additional documentation, usage docs, etc.:

An example of a partial FluentBit resource with this new property might look like this:

apiVersion: fluentbit.fluent.io/v1alpha2
kind: FluentBit
metadata:
  name: fluent-bit
  namespace: fluent
  labels:
    app.kubernetes.io/name: fluent-bit
spec:
  image: kubesphere/fluent-bit:v2.0.9
  metricsPort: 32020

ja185293
ja185293 previously approved these changes Feb 22, 2023
@wanjunlei
Copy link
Collaborator

By default, fluent-bit will not start the metrics server, so does it need to change the HttpServer to true and set the HttpPort when the MetricsPort is set? Or do these need to be manually set by the user?

@dh185221
Copy link
Contributor Author

By default, fluent-bit will not start the metrics server, so does it need to change the HttpServer to true and set the HttpPort when the MetricsPort is set? Or do these need to be manually set by the user?

I think in this case if the user specifies metricsPort inside their FluentBit resource then they would need to match that up with the port in their ClusterFluentBitConfig definition.

apiVersion: fluentbit.fluent.io/v1alpha2
kind: FluentBit
metadata:
  name: fluent-bit
  namespace: fluent
  labels:
    app.kubernetes.io/name: fluent-bit
spec:
  image: kubesphere/fluent-bit:v2.0.9
  metricsPort: 32020
  .
  .
apiVersion: fluentbit.fluent.io/v1alpha2
kind: ClusterFluentBitConfig
metadata:
  name: fluent-bit-config
  labels:
    app.kubernetes.io/name: fluent-bit
  namespace: fluent-operator
spec:
  service:
    daemon: false
    flushSeconds: 5
    httpListen: 0.0.0.0
    httpPort: 32020
    httpServer: true
    logLevel: info
    parsersFile: parsers.conf
  filterSelector:
    matchLabels:
      fluentbit.fluent.io/enabled: "true"
  inputSelector:
    matchLabels:
      fluentbit.fluent.io/enabled: "true"
  outputSelector:
    matchLabels:
      fluentbit.fluent.io/enabled: "true"

@benjaminhuo
Copy link
Member

benjaminhuo commented Feb 27, 2023

I think in this case if the user specifies metricsPort inside their FluentBit resource then they would need to match that up with the port in their ClusterFluentBitConfig definition.

Agree, @dh185221 can we add this to the metricsPort comments? https://github.com/fluent/fluent-operator/pull/587/files#diff-5c477d8ee7708b4cadb8cc2e2435185df0d8a187b6dc26e351b75a3d0547c422R91

This change allows a user to specify a metrics port as part of their `FluentBit` custom resource.  This is useful for those who need to use a port other than 2020.

An example of a partial FluentBit resource with this new property might look like this:

```
apiVersion: fluentbit.fluent.io/v1alpha2
kind: FluentBit
metadata:
  name: fluent-bit
  namespace: fluent
  labels:
    app.kubernetes.io/name: fluent-bit
spec:
  image: kubesphere/fluent-bit:v2.0.9
  metricsPort: 32020
.
.
.
```

Signed-off-by: Dale Hille <dh185221@ncr.com>
Signed-off-by: Dale Hille <dh185221@ncr.com>
@benjaminhuo benjaminhuo merged commit 72ed3c1 into fluent:master Feb 27, 2023
dh185221 added a commit to dh185221/fluent-operator that referenced this pull request Feb 27, 2023
Update the manifests that should have been updated with fluent#587 for the `metricsPort` addition.

Signed-off-by: Dale Hille <dh185221@ncr.com>
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.

None yet

4 participants