m/n/core/roleserve: rework cluster membership, reuse control plane connections
This changes up roleserver internals to simplify the handling of cluster
membership state. The end goal is to allow reusing control plane gRPC
connections across different components in a node, but the refactor goes
a bit beyond that.
Ever since the introduction of the rpc resolver, we have effectively
simplifies the control plane startup problem. This is because the
resolver allows the rest of the system to dynamically switch between
different gRPC endpoints for the control plane.
What this means is that some of the existing complexity in the
roleserver (which predates the resolver) can be thrown away. Notably, we
remove the ClusterMembership structure, and replace it with two
significantly simpler structures that represent two separate facts about
he local node:
1. localControlPlane carries information about whether this node has a
locally running control plane. This is only used by the statuspusher
(to report whether the control plane is running) and by the
Kubernetes control plane.
2. curatorConnection carries the credentials, resolver and an open gRPC
connection to the control plane, and is the only roleserver
EventValue now used by the vast majority of the roleserver runnables.
The resulting code, especially inside the control plane roleserver
runnable, is now less complex, at the cost of a bit of an ugly refactor.
Change-Id: Idbe1ff2ac3bfb2d570bed040a2f78ccabb66caba
Reviewed-on: https://review.monogon.dev/c/monogon/+/1749
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/core/roleserve/BUILD.bazel b/metropolis/node/core/roleserve/BUILD.bazel
index 2d62ef4..ab84395 100644
--- a/metropolis/node/core/roleserve/BUILD.bazel
+++ b/metropolis/node/core/roleserve/BUILD.bazel
@@ -4,10 +4,7 @@
name = "roleserve",
srcs = [
"roleserve.go",
- "value_bootstrapdata.go",
- "value_clustermembership.go",
- "value_kubernetes.go",
- "value_node.go",
+ "values.go",
"worker_clusternet.go",
"worker_controlplane.go",
"worker_heartbeat.go",
@@ -52,7 +49,10 @@
embed = [":roleserve"],
deps = [
"//metropolis/node",
+ "//metropolis/node/core/consensus",
+ "//metropolis/node/core/curator",
"//metropolis/node/core/curator/proto/api",
+ "//metropolis/node/core/rpc",
"//metropolis/pkg/supervisor",
"//metropolis/proto/common",
"@com_github_cenkalti_backoff_v4//:backoff",