Add a log line to help track node eligibility (#14125)

Co-authored-by: James Rasell <jrasell@hashicorp.com>
This commit is contained in:
Kellen Fox 2022-09-06 05:03:33 -07:00 committed by GitHub
parent 6e927fa125
commit 5086368a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

3
.changelog/14125.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
server: Log when a node's eligibility changes
```

View File

@ -661,6 +661,7 @@ func (n *Node) UpdateDrain(args *structs.NodeUpdateDrainRequest,
// If the node is transitioning to be eligible, create Node evaluations
// because there may be a System job registered that should be evaluated.
if node.SchedulingEligibility == structs.NodeSchedulingIneligible && args.MarkEligible && args.DrainStrategy == nil {
n.logger.Info("node transitioning to eligible state", "node_id", node.ID)
evalIDs, evalIndex, err := n.createNodeEvals(node, index)
if err != nil {
n.logger.Error("eval creation failed", "error", err)
@ -736,8 +737,10 @@ func (n *Node) UpdateEligibility(args *structs.NodeUpdateEligibilityRequest,
if node.SchedulingEligibility == args.Eligibility {
return nil // Nothing to do
} else if args.Eligibility == structs.NodeSchedulingEligible {
n.logger.Info("node transitioning to eligible state", "node_id", node.ID)
args.NodeEvent.SetMessage(NodeEligibilityEventEligible)
} else {
n.logger.Info("node transitioning to ineligible state", "node_id", node.ID)
args.NodeEvent.SetMessage(NodeEligibilityEventIneligible)
}