Skip to content

Commit

Permalink
improve statefulset logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alecrajeev committed Feb 15, 2024
1 parent c57219e commit 581d83e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ func (c *controller) sync(ctx context.Context) {

statefulsets := make(map[string]*appsv1.StatefulSet)

var matchingStatefulSet bool

for _, obj := range c.ssetInf.GetStore().List() {
sts, ok := obj.(*appsv1.StatefulSet)
if !ok {
Expand All @@ -560,6 +562,8 @@ func (c *controller) sync(ctx context.Context) {
hashring, ok := sts.Labels[hashringLabelKey]
if !ok {
continue
} else {
matchingStatefulSet = true
}

// If there's an increase in replicas we poll for the new replicas to be ready
Expand All @@ -584,6 +588,10 @@ func (c *controller) sync(ctx context.Context) {
time.Sleep(c.options.scaleTimeout) // Give some time for all replicas before they receive hundreds req/s
}

if !matchingStatefulSet {
level.Warn(c.logger).Log("msg", "could not find a statefulset with the label key "+hashringLabelKey)
}

c.populate(ctx, hashrings, statefulsets)

err = c.saveHashring(ctx, hashrings, cm)
Expand Down

0 comments on commit 581d83e

Please sign in to comment.