m/n/core/cluster: rewrite bootstrap to conform to cluster lifecycle DD

This removes the existing cluster/manager code and reimplements it from
scratch, finally implementing the cluster lifecycle design document for
cluster bootstrap.

Test Plan:
E2e should cover this. Maybe we could unit test the manager? But that would
require a ton of DI work. Not sure if it's worth it.

X-Origin-Diff: phab/D735
GitOrigin-RevId: b00c97b0a102a21605d16086df82a6ece6eb7f4d
diff --git a/metropolis/node/core/consensus/consensus.go b/metropolis/node/core/consensus/consensus.go
index 2bbe1ae..33a352a 100644
--- a/metropolis/node/core/consensus/consensus.go
+++ b/metropolis/node/core/consensus/consensus.go
@@ -91,9 +91,8 @@
 	// Metropolis setting.
 	Port int
 
-	// ExternalHost is used by tests to override the address at which etcd should listen for peer connections.
-	// TODO(q3k): make this unexported once the new cluster manager logic lands.
-	ExternalHost string
+	// externalHost is used by tests to override the address at which etcd should listen for peer connections.
+	externalHost string
 }
 
 func New(config Config) *Service {
@@ -144,13 +143,13 @@
 
 	// Always listen on the address pointed to by our name - unless running in
 	// tests, where we can't control our hostname easily.
-	ExternalHost := fmt.Sprintf("%s:%d", s.config.Name, port)
-	if s.config.ExternalHost != "" {
-		ExternalHost = fmt.Sprintf("%s:%d", s.config.ExternalHost, port)
+	externalHost := fmt.Sprintf("%s:%d", s.config.Name, port)
+	if s.config.externalHost != "" {
+		externalHost = fmt.Sprintf("%s:%d", s.config.externalHost, port)
 	}
 	cfg.APUrls = []url.URL{{
 		Scheme: "https",
-		Host:   ExternalHost,
+		Host:   externalHost,
 	}}
 
 	if s.config.NewCluster {
diff --git a/metropolis/node/core/consensus/consensus_test.go b/metropolis/node/core/consensus/consensus_test.go
index 00f4414..8e26535 100644
--- a/metropolis/node/core/consensus/consensus_test.go
+++ b/metropolis/node/core/consensus/consensus_test.go
@@ -90,7 +90,7 @@
 		Name:         "test",
 		NewCluster:   true,
 		Port:         freeport.MustConsume(freeport.AllocateTCPPort()),
-		ExternalHost: "127.0.0.1",
+		externalHost: "127.0.0.1",
 	})
 
 	supervisor.New(b.ctx, etcd.Run)
@@ -114,7 +114,7 @@
 		Name:         "test",
 		NewCluster:   true,
 		Port:         freeport.MustConsume(freeport.AllocateTCPPort()),
-		ExternalHost: "127.0.0.1",
+		externalHost: "127.0.0.1",
 	})
 	supervisor.New(b.ctx, etcd.Run)
 	waitEtcd(t, etcd)
@@ -157,7 +157,7 @@
 			Name:         "test",
 			NewCluster:   new,
 			Port:         freeport.MustConsume(freeport.AllocateTCPPort()),
-			ExternalHost: "127.0.0.1",
+			externalHost: "127.0.0.1",
 		})
 		ctx, ctxC := context.WithCancel(b.ctx)
 		supervisor.New(ctx, etcd.Run)
@@ -201,7 +201,7 @@
 		Name:         "test",
 		NewCluster:   true,
 		Port:         freeport.MustConsume(freeport.AllocateTCPPort()),
-		ExternalHost: "127.0.0.1",
+		externalHost: "127.0.0.1",
 	})
 	supervisor.New(b.ctx, etcd.Run)
 	waitEtcd(t, etcd)