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

Fix issue which disables clustering unintentionally. #7081

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ internal API changes are not present.
Main (unreleased)
-----------------

### Bugfixes

- `loki.source.podlogs`: Fixed a bug which prevented clustering from working and caused duplicate logs to be sent.
The bug only happened when no `selector` or `namespace_selector` blocks were specified in the Agent configuration. (@ptodev)

### Enhancements

- Upgrade `github.com/goccy/go-json` to v0.10.4, which reduces the memory consumption of an Agent instance by 20MB.
Expand Down
5 changes: 4 additions & 1 deletion internal/component/loki/source/podlogs/podlogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ func (c *Component) updateTailer(args Arguments) error {
// updateReconciler updates the state of the reconciler. This must only be
// called after updateTailer. mut must be held when calling.
func (c *Component) updateReconciler(args Arguments) error {
// The clustering settings should always be updated,
// even if the selectors haven't changed.
c.reconciler.SetDistribute(args.Clustering.Enabled)

var (
selectorChanged = !reflect.DeepEqual(c.args.Selector, args.Selector)
namespaceSelectorChanged = !reflect.DeepEqual(c.args.NamespaceSelector, args.NamespaceSelector)
Expand All @@ -276,7 +280,6 @@ func (c *Component) updateReconciler(args Arguments) error {
}

c.reconciler.UpdateSelectors(sel, nsSel)
c.reconciler.SetDistribute(args.Clustering.Enabled)

// Request a reconcile so the new selectors get applied.
c.controller.RequestReconcile()
Expand Down
Loading