Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch controller: fix panic and dropped error result during node shutdown #7875

Merged
merged 2 commits into from
Jun 7, 2024
Merged
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
4 changes: 3 additions & 1 deletion pkg/controller/elasticsearch/driver/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ func (d *defaultDriver) handleUpgrades(
nodeShutdown := shutdown.NewNodeShutdown(esClient, nodeNameToID, esclient.Restart, d.ES.ResourceVersion, logger)

// Maybe re-enable shards allocation and delete shutdowns if upgraded nodes are back into the cluster.
results.WithResults(d.maybeCompleteNodeUpgrades(ctx, esClient, esState, nodeShutdown))
if results.WithResults(d.maybeCompleteNodeUpgrades(ctx, esClient, esState, nodeShutdown)).HasError() {
return results
}

// Get the list of pods currently existing in the StatefulSetList
currentPods, err := statefulSets.GetActualPods(d.Client)
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/elasticsearch/shutdown/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func NewNodeShutdown(c esclient.Client, podToNodeID map[string]string, typ escli
typ: typ,
podToNodeID: podToNodeID,
reason: reason,
shutdowns: make(map[string]esclient.NodeShutdown),
log: l,
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test/elasticsearch/checks_restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func newNodeShutdownWatcher(es esv1.Elasticsearch) test.Watcher {
}
}
if len(restarts) > maxConcurrentRestarts {
observedErrors = append(observedErrors, fmt.Errorf("expected less than %d, got %d, restarts: %v", maxConcurrentRestarts, len(restarts), restarts))
observedErrors = append(observedErrors, fmt.Errorf("expected at most %d, got %d, restarts: %v", maxConcurrentRestarts, len(restarts), restarts))
}
},
func(k *test.K8sClient, t *testing.T) { //nolint:thelper
Expand Down