Do not attempt to write a new TLS keyring at startup if raft is already setup (#17079)

This commit is contained in:
Nick Cabatoff
2022-09-09 12:19:57 -04:00
committed by GitHub
parent b7f4b6d6ad
commit 24c9b42f8c
2 changed files with 58 additions and 54 deletions

2
changelog/17079.txt Normal file
View File

@@ -0,0 +1,2 @@
```release-note:bug
storage/raft: Fix error writing raft TLS keyring during follower joins

View File

@@ -73,14 +73,15 @@ func (c *Core) startRaftBackend(ctx context.Context) (retErr error) {
return nil
}
var creating bool
var raftTLS *raft.TLSKeyring
if !raftBackend.Initialized() {
// Retrieve the raft TLS information
raftTLSEntry, err := c.barrier.Get(ctx, raftTLSStoragePath)
if err != nil {
return err
}
var creating bool
var raftTLS *raft.TLSKeyring
switch raftTLSEntry {
case nil:
// If this is HA-only and no TLS keyring is found, that means the
@@ -140,6 +141,7 @@ func (c *Core) startRaftBackend(ctx context.Context) (retErr error) {
}); err != nil {
return err
}
}
defer func() {
if retErr != nil {