Skip to content

Commit

Permalink
loki.source.podlogs: Fix issue which disables clustering unintentio…
Browse files Browse the repository at this point in the history
…nally. (#2187)

* Fix issue which disables clustering unintentionally.
  • Loading branch information
ptodev authored Nov 28, 2024
1 parent e61ad14 commit 5d47b91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Main (unreleased)

- Fix a race condition where the ui service was dependent on starting after the remotecfg service, which is not guaranteed. (@dehaansa & @erikbaranowski)

- `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 Alloy configuration. (@ptodev)

### Other changes

- Change the stability of the `livedebugging` feature from "experimental" to "generally available". (@wildum)
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

0 comments on commit 5d47b91

Please sign in to comment.