Skip to content

Commit 7543776

Browse files
committed
Fixed PR comments
1 parent 881d9e9 commit 7543776

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

controllers/humiocluster_controller.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"github.com/humio/humio-operator/internal/api/humiographql"
2424
"reflect"
25+
goslices "slices"
2526
"strconv"
2627
"strings"
2728
"time"
@@ -2186,11 +2187,13 @@ func (r *HumioClusterReconciler) processDownscaling(ctx context.Context, hc *hum
21862187
}
21872188
if nodeCanBeSafelyUnregistered {
21882189
r.Log.Info(fmt.Sprintf("successfully evicted data from vhost %d", vhost))
2189-
hc.Status.EvictedNodeIds = append(hc.Status.EvictedNodeIds, vhost) // keep track of the evicted node for unregistering
2190-
err = r.Status().Update(ctx, hc)
2191-
if err != nil {
2192-
r.Log.Error(err, "failed to update cluster status")
2193-
return reconcile.Result{}, err
2190+
if !goslices.Contains(hc.Status.EvictedNodeIds, vhost) {
2191+
hc.Status.EvictedNodeIds = append(hc.Status.EvictedNodeIds, vhost) // keep track of the evicted node for unregistering
2192+
err = r.Status().Update(ctx, hc)
2193+
if err != nil {
2194+
r.Log.Error(err, "failed to update cluster status")
2195+
return reconcile.Result{}, err
2196+
}
21942197
}
21952198
r.Log.Info(fmt.Sprintf("removing pod %s containing vhost %d", pod.Name, vhost))
21962199
if err := r.Delete(ctx, &pod); err != nil { // delete pod before unregistering node

0 commit comments

Comments
 (0)