m/n/c/curator: use full election prefix
NewElection appends "/" to the prefix. If we manually get the leader, we
should also append "/". Otherwise, we could get the wrong result if a
new key which starts with "/leader" is added.
Change-Id: I4bcafa945b14d610a6a1f4903452081c3e802e73
Reviewed-on: https://review.monogon.dev/c/monogon/+/2950
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Vouch-Run-CI: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/curator/curator.go b/metropolis/node/core/curator/curator.go
index 5892090..149cb18 100644
--- a/metropolis/node/core/curator/curator.go
+++ b/metropolis/node/core/curator/curator.go
@@ -258,7 +258,7 @@
// odd 'Unimplemented' errors.
func (s *Service) cleanupPreviousLifetime(ctx context.Context, cl client.Namespaced) error {
// Get the active leader key and value.
- resp, err := cl.Get(ctx, electionPrefix, clientv3.WithFirstCreate()...)
+ resp, err := cl.Get(ctx, electionPrefix+"/", clientv3.WithFirstCreate()...)
if err != nil {
return err
}