Skip to content

Commit

Permalink
Fix issue which disables clustering unintentionally. (#7081)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptodev authored Dec 19, 2024
1 parent 2ed5557 commit c11f0c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit c11f0c0

Please sign in to comment.