Skip to content

Commit

Permalink
backport of commit 8493f3a
Browse files Browse the repository at this point in the history
  • Loading branch information
angrycub committed Sep 8, 2022
1 parent 4fb077b commit 1d7b45b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
5 changes: 3 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1900,11 +1900,12 @@ func (c *Client) updateNodeStatus() error {
"req_latency", end.Sub(start), "heartbeat_ttl", oldTTL, "since_last_heartbeat", time.Since(last))
}
}

// Check heartbeat response for information about the server-side scheduling
// state of this node
c.UpdateConfig(func(c *config.Config) {
if resp.ClientStatus != nil {
c.Node.SchedulingEligibility = resp.ClientStatus.SchedulingEligibility
if resp.SchedulingEligibility != "" {
c.Node.SchedulingEligibility = resp.SchedulingEligibility
}
})

Expand Down
4 changes: 1 addition & 3 deletions nomad/node_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ func (n *Node) constructNodeServerInfoResponse(nodeID string, snap *state.StateS

// Add ClientStatus information to heartbeat response.
node, _ := snap.NodeByID(nil, nodeID)
reply.ClientStatus = &structs.ClientStatus{
SchedulingEligibility: node.SchedulingEligibility,
}
reply.SchedulingEligibility = node.SchedulingEligibility

// TODO(sean@): Use an indexed node count instead
//
Expand Down
10 changes: 2 additions & 8 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1339,19 +1339,13 @@ type NodeUpdateResponse struct {
// region.
Servers []*NodeServerInfo

// ClientStatus is used to inform clients what the server-side
// SchedulingEligibility is used to inform clients what the server-side
// has for their scheduling status during heartbeats.
ClientStatus *ClientStatus
SchedulingEligibility string

QueryMeta
}

// ClientStatus is used to inform clients what the server-side
// has for their scheduling status during heartbeats.
type ClientStatus struct {
SchedulingEligibility string
}

// NodeDrainUpdateResponse is used to respond to a node drain update
type NodeDrainUpdateResponse struct {
NodeModifyIndex uint64
Expand Down

0 comments on commit 1d7b45b

Please sign in to comment.