From 1d7b45b10aa36fd75dca80b450c19e25e07d0641 Mon Sep 17 00:00:00 2001 From: Charlie Voiselle <464492+angrycub@users.noreply.github.com> Date: Thu, 8 Sep 2022 17:45:32 +0000 Subject: [PATCH] backport of commit 8493f3a0c5dd8b75c31266aeb590c9a5f5bf9060 --- client/client.go | 5 +++-- nomad/node_endpoint.go | 4 +--- nomad/structs/structs.go | 10 ++-------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/client/client.go b/client/client.go index 65f453b10c3..c112542cb67 100644 --- a/client/client.go +++ b/client/client.go @@ -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 } }) diff --git a/nomad/node_endpoint.go b/nomad/node_endpoint.go index 820ed5b82dc..35049c3d375 100644 --- a/nomad/node_endpoint.go +++ b/nomad/node_endpoint.go @@ -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 // diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index dbb33764ccb..58c71ec9055 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -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