Skip to content
Open
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
1 change: 1 addition & 0 deletions operator/internal/manifests/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func NewIngesterStatefulSet(opts Options) *appsv1.StatefulSet {
fmt.Sprintf("-config.file=%s", path.Join(config.LokiConfigMountDir, config.LokiConfigFileName)),
fmt.Sprintf("-runtime-config.file=%s", path.Join(config.LokiConfigMountDir, config.LokiRuntimeConfigFileName)),
"-config.expand-env=true",
fmt.Sprintf("-ingester.tokens-file-path=%s", ingesterTokensFilePath),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restarts still reshard ingesters

Medium Severity

Adding -ingester.tokens-file-path leaves ingester.unregister-on-shutdown at its default true. Clean pod restarts still remove the ingester from the ring, so rollouts reshard data even though the next process reloads the same tokens.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d8a91f2. Configure here.

Copy link
Copy Markdown
Author

@saswatamcode saswatamcode May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
ReadinessProbe: lokiReadinessProbe(),
LivenessProbe: lokiLivenessProbe(),
Expand Down
19 changes: 19 additions & 0 deletions operator/internal/manifests/ingester_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package manifests

import (
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -161,6 +162,24 @@ func TestBuildIngester_PodDisruptionBudget(t *testing.T) {
}
}

func TestNewIngesterStatefulSet_HasTokensFileArg(t *testing.T) {
ss := NewIngesterStatefulSet(Options{
Name: "abcd",
Namespace: "efgh",
Stack: lokiv1.LokiStackSpec{
StorageClassName: "standard",
Template: &lokiv1.LokiTemplateSpec{
Ingester: &lokiv1.LokiComponentSpec{
Replicas: 1,
},
},
},
})

container := ss.Spec.Template.Spec.Containers[0]
require.Contains(t, container.Args, fmt.Sprintf("-ingester.tokens-file-path=%s", ingesterTokensFilePath))
}

func TestNewIngesterStatefulSet_TopologySpreadConstraints(t *testing.T) {
obj, _ := BuildIngester(Options{
Name: "abcd",
Expand Down
2 changes: 2 additions & 0 deletions operator/internal/manifests/var.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const (
dataDirectory = "/tmp/loki"
rulesStorageDirectory = "/tmp/rules"

ingesterTokensFilePath = dataDirectory + "/ring-tokens"

rulerContainerName = "loki-ruler"

// EnvRelatedImageLoki is the environment variable to fetch the Loki image pullspec.
Expand Down
Loading