Commit 5b8f9aba authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Handle cluster join as create if we're the only member

Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com> (cherry picked from commit 36537244) Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com>
parent 11b9afb1
...@@ -559,6 +559,7 @@ func (e *ETCD) join(ctx context.Context, clientAccessInfo *clientaccess.Info) er ...@@ -559,6 +559,7 @@ func (e *ETCD) join(ctx context.Context, clientAccessInfo *clientaccess.Info) er
defer cancel() defer cancel()
var ( var (
state string
cluster []string cluster []string
add = true add = true
) )
...@@ -620,12 +621,19 @@ func (e *ETCD) join(ctx context.Context, clientAccessInfo *clientaccess.Info) er ...@@ -620,12 +621,19 @@ func (e *ETCD) join(ctx context.Context, clientAccessInfo *clientaccess.Info) er
return err return err
} }
cluster = append(cluster, fmt.Sprintf("%s=%s", e.name, e.peerURL())) cluster = append(cluster, fmt.Sprintf("%s=%s", e.name, e.peerURL()))
state = "existing"
} else if len(cluster) > 1 {
logrus.Infof("Starting etcd to join cluster with members %v", cluster)
state = "existing"
} else {
logrus.Infof("Starting etcd for new cluster")
state = "new"
} }
logrus.Infof("Starting etcd to join cluster with members %v", cluster)
return e.cluster(ctx, false, executor.InitialOptions{ return e.cluster(ctx, false, executor.InitialOptions{
Cluster: strings.Join(cluster, ","), AdvertisePeerURL: e.peerURL(),
State: "existing", Cluster: strings.Join(cluster, ","),
State: state,
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment