Skip to content

Commit

Permalink
Turn around terminating predicate so that non terminating nodes are i…
Browse files Browse the repository at this point in the history
…n the node set
  • Loading branch information
Björn Fischer committed Nov 21, 2024
1 parent fe68089 commit 192d491
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions controllers/service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ var (
nodeIncludedPredicate,
nodeUnTaintedPredicate,
nodeReadyPredicate,
nodeTerminatingPredicate,
nodeNotTerminatingPredicate,
}
etpLocalNodePredicates []NodeConditionPredicate = []NodeConditionPredicate{
nodeIncludedPredicate,
Expand All @@ -1022,6 +1022,7 @@ var (
// excluded at that time and cause connections on said node to not
// connection drain.
nodeUnTaintedPredicate,
nodeNotTerminatingPredicate,
}
)

Expand Down Expand Up @@ -1053,15 +1054,15 @@ func nodeUnTaintedPredicate(node *v1.Node) bool {

const NodeTerminationCondition v1.NodeConditionType = "Terminating"

// Returns true if the node is terminating, based on the Gardener condition.
// Returns true if the node is not terminating, based on the Gardener condition.
// https://github.com/gardener/machine-controller-manager/blob/fc341881a5e71d7c5f240ca73415f967084aa85b/pkg/util/provider/machineutils/utils.go#L61
func nodeTerminatingPredicate(node *v1.Node) bool {
func nodeNotTerminatingPredicate(node *v1.Node) bool {
for _, cond := range node.Status.Conditions {
if cond.Type == NodeTerminationCondition {
return cond.Status == v1.ConditionTrue
return cond.Status != v1.ConditionTrue
}
}
return false
return true
}

// We consider the node for load balancing only when its NodeReady condition status is ConditionTrue
Expand Down

0 comments on commit 192d491

Please sign in to comment.