fluent / fluent-operator

Operate Fluent Bit and Fluentd in the Kubernetes way - Previously known as FluentBit Operator
Apache License 2.0
578 stars 246 forks source link

Fix service monitor label selector scope #1284

Closed rmvangun closed 1 month ago

rmvangun commented 1 month ago

What this PR does / why we need it:

This block in the service monitor fails to correctly use the with context:

  selector:
    matchLabels:
      {{- include "fluent-operator.selectorLabels" . | nindent 6 }}
      {{- with .Values.fluentbit.labels }}
      {{- toYaml .Values.fluentbit.labels | nindent 6}}
      {{- end }}

As a result, populating .Values.fluentbit.labels results in:

Helm install failed for release monitoring/fluent-operator with chart fluent-operator@3.0.0: template: fluent-operator/templates/fluentbit-servicemonitor.yaml:34:24: executing "fluent-operator/templates/fluentbit-servicemonitor.yaml" at <.Values.fluentbit.labels>: nil pointer evaluating interface {}.fluentbit

Which issue(s) this PR fixes:

None, can create an issue if necessary

Does this PR introduced a user-facing change?

Fixed the helm template where the service monitor incorrectly refers to variables in a "with" block

Additional documentation, usage docs, etc.: