Skip to content

Commit

Permalink
Fixed PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bsocaciu committed Feb 24, 2025
1 parent 881d9e9 commit 7543776
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions controllers/humiocluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"github.com/humio/humio-operator/internal/api/humiographql"
"reflect"
goslices "slices"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -2186,11 +2187,13 @@ func (r *HumioClusterReconciler) processDownscaling(ctx context.Context, hc *hum
}
if nodeCanBeSafelyUnregistered {
r.Log.Info(fmt.Sprintf("successfully evicted data from vhost %d", vhost))
hc.Status.EvictedNodeIds = append(hc.Status.EvictedNodeIds, vhost) // keep track of the evicted node for unregistering
err = r.Status().Update(ctx, hc)
if err != nil {
r.Log.Error(err, "failed to update cluster status")
return reconcile.Result{}, err
if !goslices.Contains(hc.Status.EvictedNodeIds, vhost) {
hc.Status.EvictedNodeIds = append(hc.Status.EvictedNodeIds, vhost) // keep track of the evicted node for unregistering
err = r.Status().Update(ctx, hc)
if err != nil {
r.Log.Error(err, "failed to update cluster status")
return reconcile.Result{}, err
}
}
r.Log.Info(fmt.Sprintf("removing pod %s containing vhost %d", pod.Name, vhost))
if err := r.Delete(ctx, &pod); err != nil { // delete pod before unregistering node
Expand Down

0 comments on commit 7543776

Please sign in to comment.