Skip to content

Commit

Permalink
still join existing, even if we are already a member
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-deboer committed Mar 23, 2017
1 parent 0d503ff commit 5251ed3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (d *Discovery) DiscoverEnvironment() (map[string]string, error) {
log.Debugf("Local master: %#v", *localMaster)
}
// this instance is an expected master
if len(currentMembers) > 0 && !containsMember(currentMembers, *localMaster) && uptime >= d.MinimumUptimeToJoin {
if len(currentMembers) > 0 && uptime >= d.MinimumUptimeToJoin {
// there is an existing cluster
if err = d.assertSaneClusterState(expectedMembers, currentMembers); err != nil {
log.Fatal(err)
Expand All @@ -119,8 +119,10 @@ func (d *Discovery) DiscoverEnvironment() (map[string]string, error) {
log.Infof("Joining existing cluster as a master")
// TODO: what if we encounter a state where not of the expected masters are
// members of the current cluster?
if err := d.joinExistingCluster(membersAPI, expectedMembers, localMaster); err != nil {
log.Fatal(err)
if !containsMember(currentMembers, *localMaster) {
if err := d.joinExistingCluster(membersAPI, expectedMembers, localMaster); err != nil {
log.Fatal(err)
}
}
environment["ETCD_INITIAL_CLUSTER_STATE"] = "existing"
} else {
Expand Down

0 comments on commit 5251ed3

Please sign in to comment.