Skip to content

Commit 5d47b91

Browse files
authored
loki.source.podlogs: Fix issue which disables clustering unintentionally. (#2187)
* Fix issue which disables clustering unintentionally.
1 parent e61ad14 commit 5d47b91

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Main (unreleased)
4848

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

51+
- `loki.source.podlogs`: Fixed a bug which prevented clustering from working and caused duplicate logs to be sent.
52+
The bug only happened when no `selector` or `namespace_selector` blocks were specified in the Alloy configuration. (@ptodev)
53+
5154
### Other changes
5255

5356
- Change the stability of the `livedebugging` feature from "experimental" to "generally available". (@wildum)

internal/component/loki/source/podlogs/podlogs.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ func (c *Component) updateTailer(args Arguments) error {
258258
// updateReconciler updates the state of the reconciler. This must only be
259259
// called after updateTailer. mut must be held when calling.
260260
func (c *Component) updateReconciler(args Arguments) error {
261+
// The clustering settings should always be updated,
262+
// even if the selectors haven't changed.
263+
c.reconciler.SetDistribute(args.Clustering.Enabled)
264+
261265
var (
262266
selectorChanged = !reflect.DeepEqual(c.args.Selector, args.Selector)
263267
namespaceSelectorChanged = !reflect.DeepEqual(c.args.NamespaceSelector, args.NamespaceSelector)
@@ -276,7 +280,6 @@ func (c *Component) updateReconciler(args Arguments) error {
276280
}
277281

278282
c.reconciler.UpdateSelectors(sel, nsSel)
279-
c.reconciler.SetDistribute(args.Clustering.Enabled)
280283

281284
// Request a reconcile so the new selectors get applied.
282285
c.controller.RequestReconcile()

0 commit comments

Comments
 (0)