Describe the issue
When labels are added or modified in the FluentBit spec.labels field after the DaemonSet has been created, the operator attempts to update the DaemonSet's immutable spec.selector field, causing continuous reconciliation failures.
ERROR Reconciler error {"controller": "FluentBit", "error": "DaemonSet.apps \"fluent-bit\" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{\"app\":\"fluentbit\", \"fluentbit.fluent.io/enabled\":\"true\"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable"}
To Reproduce
- Deploy fluent-operator with a FluentBit CR in DaemonSet mode with initial labels:
apiVersion: fluentbit.fluent.io/v1alpha2
kind: FluentBit
metadata:
name: fluent-bit
spec:
labels:
app: fluentbit
- Wait for DaemonSet to be created and running
- Add a new label to the FluentBit CR:
spec:
labels:
app: fluentbit
fluentbit.fluent.io/enabled: "true" # New label added
-
Apply the updated CR: kubectl apply -f fluentbit.yaml
-
Observe continuous reconciliation failures in operator logs:
ERROR Reconciler error {"controller": "FluentBit", "error": "DaemonSet.apps \"fluent-bit\" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{\"app\":\"fluentbit\", \"fluentbit.fluent.io/enabled\":\"true\"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable"}
Expected behavior
When labels are changed in the FluentBit CR, the operator handles the change without causing continuous reconciliation failures. The user's intended label changes should be applied to the DaemonSet (or the operator should provide clear guidance on how to proceed).
Your Environment
- Fluent Operator version: v3.4.0
- Container Runtime: containerd
- Operating system: Amazon Linux 2023
- Kernel version: 6.12.x
How did you install fluent operator?
Installed via Helm chart with FluxCD
Additional context
Current workaround: Manually delete the DaemonSet to force recreation:
kubectl delete daemonset fluent-bit -n <namespace>
The operator immediately recreates it with the updated selector.
Related: Issue #1424 discusses inconsistent label/annotation behavior in FluentBit CR. Both issues involve how labels in the FluentBit CR affect the DaemonSet.
Impact:
- Reconciliation fails continuously
- Adding/removing labels in FluentBit CR requires manual intervention
- Other legitimate DaemonSet updates are also blocked when selector mismatch exists
Describe the issue
When labels are added or modified in the FluentBit
spec.labelsfield after the DaemonSet has been created, the operator attempts to update the DaemonSet's immutablespec.selectorfield, causing continuous reconciliation failures.To Reproduce
Apply the updated CR:
kubectl apply -f fluentbit.yamlObserve continuous reconciliation failures in operator logs:
Expected behavior
When labels are changed in the FluentBit CR, the operator handles the change without causing continuous reconciliation failures. The user's intended label changes should be applied to the DaemonSet (or the operator should provide clear guidance on how to proceed).
Your Environment
How did you install fluent operator?
Installed via Helm chart with FluxCD
Additional context
Current workaround: Manually delete the DaemonSet to force recreation:
The operator immediately recreates it with the updated selector.
Related: Issue #1424 discusses inconsistent label/annotation behavior in FluentBit CR. Both issues involve how labels in the FluentBit CR affect the DaemonSet.
Impact: