m/test: refactor cluster launch code, use for e2e tests
This is a light dust-off pass for the existing cluster launch code.
Notably, we separate Metropolis-specific code into a subpackage
(allowing us to make the package itself depend on the required
node/kernel images, without introducing dependency loops or unnecessary
dependencies on the Metropolis node image).
We also make the LaunchCluster code return an already authenticated
Management client, and subsequent changes will use this client to add
more nodes to the running cluster.
We then move the E2E test to use LaunchCluster instead of LaunchNode, in
preparation for running a multi-node cluster in the E2E test.
We also add some more log calls and clean up the existing ones to make
it clear which subsystem (launch, launch/cluster or e2e) is respondible
for each message.
Change-Id: I838bdc75073831fe94b9cdcef4fb3ab6bf8cba2c
Reviewed-on: https://review.monogon.dev/c/monogon/+/343
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/test/launch/cluster/insecure_key.go b/metropolis/test/launch/cluster/insecure_key.go
new file mode 100644
index 0000000..48cd6d8
--- /dev/null
+++ b/metropolis/test/launch/cluster/insecure_key.go
@@ -0,0 +1,40 @@
+// Copyright 2020 The Monogon Project Authors.
+//
+// SPDX-License-Identifier: Apache-2.0
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cluster
+
+import (
+ "crypto/ed25519"
+
+ apb "source.monogon.dev/metropolis/proto/api"
+)
+
+var (
+ // InsecurePrivateKey is a ED25519 key that can be used during development as
+ // a fixed Owner Key when bootstrapping new clusters.
+ InsecurePrivateKey = ed25519.NewKeyFromSeed([]byte(
+ "\xb5\xcf\x35\x0f\xbf\xfb\xea\xfa\xa0\xf0\x29\x9d\xfa\xf7\xca\x6f" +
+ "\xa2\xc2\xc7\x87\xd7\x03\x3e\xb2\x11\x4f\x36\xe0\x22\x73\x4f\x87"))
+ // InsecurePublicKey is the ED25519 public key corresponding to
+ // InsecurePrivateKey.
+ InsecurePublicKey = InsecurePrivateKey.Public().(ed25519.PublicKey)
+ // InsecureClusterBootstrap is a ClusterBootstrap message to be used within
+ // NodeParameters when bootstrapping a development cluster that should be owned
+ // by the InsecurePrivateKey.
+ InsecureClusterBootstrap = &apb.NodeParameters_ClusterBootstrap{
+ OwnerPublicKey: InsecurePublicKey,
+ }
+)