From 9813abcb09f3e9b16370cedae545ec7a9d8bd060 Mon Sep 17 00:00:00 2001 From: Aestek Date: Fri, 26 Apr 2019 22:33:41 +0200 Subject: [PATCH] Fix: fail messages after a node rename replace the new node definition (#5520) When receiving a serf faild message for a node which is not in the catalog, do not perform a register request to set is serf heath to critical as it could overwrite the node information and services if it was renamed. Fixes : #5518 --- agent/consul/leader.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/agent/consul/leader.go b/agent/consul/leader.go index 326489209..a0fd46613 100644 --- a/agent/consul/leader.go +++ b/agent/consul/leader.go @@ -1415,7 +1415,13 @@ func (s *Server) handleFailedMember(member serf.Member) error { if err != nil { return err } - if node != nil && node.Address == member.Addr.String() { + + if node == nil { + s.logger.Printf("[INFO] consul: ignoring failed event for member '%s' because it does not exist in the catalog", member.Name) + return nil + } + + if node.Address == member.Addr.String() { // Check if the serfCheck is in the critical state _, checks, err := state.NodeChecks(nil, member.Name) if err != nil {