github.com/hernad/nomad@v1.6.112/nomad/merge.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package nomad
     5  
     6  import (
     7  	"fmt"
     8  
     9  	"github.com/hashicorp/serf/serf"
    10  )
    11  
    12  // serfMergeDelegate is used to handle a cluster merge on the gossip
    13  // ring. We check that the peers are nomad servers and abort the merge
    14  // otherwise.
    15  type serfMergeDelegate struct {
    16  }
    17  
    18  func (md *serfMergeDelegate) NotifyMerge(members []*serf.Member) error {
    19  	for _, m := range members {
    20  		ok, _ := isNomadServer(*m)
    21  		if !ok {
    22  			return fmt.Errorf("member '%s' is not a server", m.Name)
    23  		}
    24  	}
    25  	return nil
    26  }