m/n/core/{curator,cluster}: refactor against new Consensus API
This updates the Curator and the Cluster Manager to use the new
Consensus API, notably to use JoinParameters and ServiceHandle.Watch.
Using JoinParameters end-to-end requires piping them through a node's
roles. For this we create a new ConsensusMember role and replicate all
the data from JoinParameters there.
We also move a whole bunch of logic that used to live in the Cluster
Manager's Status object away from it. Instead, now the Consensus
ServiceHandle is exposed directly to downstream users, providing the
same functionality.
Change-Id: I8cfa247011554553836019f60ea172dd6069f49c
Reviewed-on: https://review.monogon.dev/c/monogon/+/522
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/core/consensus/consensus.go b/metropolis/node/core/consensus/consensus.go
index f19e923..d4ab964 100644
--- a/metropolis/node/core/consensus/consensus.go
+++ b/metropolis/node/core/consensus/consensus.go
@@ -487,11 +487,16 @@
return fmt.Errorf("failed to get status: %w", err)
}
- peerURL := st.localPeerURL
- if _, err := st.cl.MemberUpdate(ctx, st.localMemberID, []string{peerURL}); err != nil {
- supervisor.Logger(ctx).Warningf("failed to update member: %v", err)
- time.Sleep(1 * time.Second)
- continue
+ if st.localPeerURL != "" {
+ supervisor.Logger(ctx).Infof("Updating local peer URL...")
+ peerURL := st.localPeerURL
+ if _, err := st.cl.MemberUpdate(ctx, st.localMemberID, []string{peerURL}); err != nil {
+ supervisor.Logger(ctx).Warningf("failed to update member: %v", err)
+ time.Sleep(1 * time.Second)
+ continue
+ }
+ } else {
+ supervisor.Logger(ctx).Infof("No local peer URL, not updating.")
}
supervisor.Signal(ctx, supervisor.SignalDone)