metropolis/test/launch: synchronize test node labels to kubernetes

Change-Id: I57361503debb1d25873a72be18e947d2d1f11511
Reviewed-on: https://review.monogon.dev/c/monogon/+/3470
Reviewed-by: Jan Schär <jan@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/test/launch/cli/launch-cluster/main.go b/metropolis/test/launch/cli/launch-cluster/main.go
index ca5d958..859e17f 100644
--- a/metropolis/test/launch/cli/launch-cluster/main.go
+++ b/metropolis/test/launch/cli/launch-cluster/main.go
@@ -134,7 +134,13 @@
 }
 
 func main() {
-	clusterConfig := cpb.ClusterConfiguration{}
+	clusterConfig := cpb.ClusterConfiguration{
+		KubernetesConfig: &cpb.ClusterConfiguration_KubernetesConfig{
+			NodeLabelsToSynchronize: []*cpb.ClusterConfiguration_KubernetesConfig_NodeLabelsToSynchronize{
+				{Regexp: "^" + mlaunch.NodeNumberKey + "$"},
+			},
+		},
+	}
 	opts := mlaunch.ClusterOptions{
 		NodeLogsToFiles:             true,
 		InitialClusterConfiguration: &clusterConfig,
diff --git a/metropolis/test/launch/cluster.go b/metropolis/test/launch/cluster.go
index ce9d246..107cd55 100644
--- a/metropolis/test/launch/cluster.go
+++ b/metropolis/test/launch/cluster.go
@@ -52,9 +52,9 @@
 )
 
 const (
-	// nodeNumberKey is the key of the node label used to carry a node's numerical
+	// NodeNumberKey is the key of the node label used to carry a node's numerical
 	// index in the test system.
-	nodeNumberKey string = "test-node-number"
+	NodeNumberKey string = "test-node-number"
 )
 
 // NodeOptions contains all options that can be passed to Launch()
@@ -770,7 +770,7 @@
 				InitialClusterConfiguration: opts.InitialClusterConfiguration,
 				Labels: &cpb.NodeLabels{
 					Pairs: []*cpb.NodeLabels_Pair{
-						{Key: nodeNumberKey, Value: "0"},
+						{Key: NodeNumberKey, Value: "0"},
 					},
 				},
 			},
@@ -997,7 +997,7 @@
 					CaCertificate:    resI.CaCertificate,
 					Labels: &cpb.NodeLabels{
 						Pairs: []*cpb.NodeLabels_Pair{
-							{Key: nodeNumberKey, Value: fmt.Sprintf("%d", i)},
+							{Key: NodeNumberKey, Value: fmt.Sprintf("%d", i)},
 						},
 					},
 				},
@@ -1039,7 +1039,7 @@
 					Pubkey: n.Pubkey,
 				}
 
-				num, err := strconv.Atoi(node.GetNodeLabel(n.Labels, nodeNumberKey))
+				num, err := strconv.Atoi(node.GetNodeLabel(n.Labels, NodeNumberKey))
 				if err != nil {
 					return nil, fmt.Errorf("node %s has undecodable number label: %w", n.Id, err)
 				}