From 9730141dd1fed0459823dce320fdbf694f297d0e Mon Sep 17 00:00:00 2001 From: dfradehubs Date: Thu, 19 Dec 2024 10:28:51 +0100 Subject: [PATCH] fix(Elasticsearch): Add un-drain of the node if timeout is reached draining it --- internal/elasticsearch/elasticsearch.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/elasticsearch/elasticsearch.go b/internal/elasticsearch/elasticsearch.go index eb4b0ae..fecdfec 100644 --- a/internal/elasticsearch/elasticsearch.go +++ b/internal/elasticsearch/elasticsearch.go @@ -169,6 +169,13 @@ func waitForNodeRemoval(ctx *v1alpha1.Context, es *elasticsearch.Client, nodeNam log.Printf("Error sending Slack notification: %v", err) } } + + // Add node again to the cluster settings + err = ClearElasticsearchClusterSettings(ctx, nodeName) + if err != nil { + return fmt.Errorf("error clearing cluster settings: %w", err) + } + return fmt.Errorf("timeout trying to remove node from cluster settings in elasticsearch: %v", ctxWithTimeout.Err()) default: // Get _cat/shards to check if nodeName has any shard inside