From bcf34c34498c511eae7fb0f45e30b6170fa27ad0 Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Wed, 30 May 2018 16:54:07 -0500 Subject: [PATCH] Set node eligibility to true when old client calls disable --- api/nodes.go | 2 +- command/agent/node_endpoint.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/nodes.go b/api/nodes.go index 59d8a9f72..581f957be 100644 --- a/api/nodes.go +++ b/api/nodes.go @@ -68,7 +68,7 @@ type NodeDrainUpdateResponse struct { // UpdateDrain is used to update the drain strategy for a given node. If // markEligible is true and the drain is being removed, the node will be marked -// as having its scheduling being elibile +// as having its scheduling being eligible func (n *Nodes) UpdateDrain(nodeID string, spec *DrainSpec, markEligible bool, q *WriteOptions) (*NodeDrainUpdateResponse, error) { req := &NodeUpdateDrainRequest{ NodeID: nodeID, diff --git a/command/agent/node_endpoint.go b/command/agent/node_endpoint.go index f998d4499..b5bac60a4 100644 --- a/command/agent/node_endpoint.go +++ b/command/agent/node_endpoint.go @@ -124,6 +124,9 @@ func (s *HTTPServer) nodeToggleDrain(resp http.ResponseWriter, req *http.Request drainRequest.DrainSpec = &api.DrainSpec{ Deadline: -1 * time.Second, } + } else { + // If drain is disabled on an old client, mark the node as eligible for backwards compatibility + drainRequest.MarkEligible = true } } else { if err := decodeBody(req, &drainRequest); err != nil {