mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
Don't touch ActiveTime in preSeal/postUnseal (#24549)
This commit is contained in:
3
changelog/24549.txt
Normal file
3
changelog/24549.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
api: sys/leader ActiveTime field no longer gets reset when we do an internal state change that doesn't change our active status.
|
||||||
|
```
|
||||||
@@ -2390,7 +2390,6 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
|
|||||||
|
|
||||||
// Mark the active time. We do this first so it can be correlated to the logs
|
// Mark the active time. We do this first so it can be correlated to the logs
|
||||||
// for the active startup.
|
// for the active startup.
|
||||||
c.activeTime = time.Now().UTC()
|
|
||||||
|
|
||||||
if err := postUnsealPhysical(c); err != nil {
|
if err := postUnsealPhysical(c); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -2766,7 +2765,6 @@ func (c *Core) preSeal() error {
|
|||||||
}
|
}
|
||||||
// Clear any pending funcs
|
// Clear any pending funcs
|
||||||
c.postUnsealFuncs = nil
|
c.postUnsealFuncs = nil
|
||||||
c.activeTime = time.Time{}
|
|
||||||
|
|
||||||
// Clear any rekey progress
|
// Clear any rekey progress
|
||||||
c.barrierRekeyConfig = nil
|
c.barrierRekeyConfig = nil
|
||||||
|
|||||||
@@ -663,6 +663,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop
|
|||||||
err = c.postUnseal(activeCtx, activeCtxCancel, standardUnsealStrategy{})
|
err = c.postUnseal(activeCtx, activeCtxCancel, standardUnsealStrategy{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
c.standby = false
|
c.standby = false
|
||||||
|
c.activeTime = time.Now()
|
||||||
c.leaderUUID = uuid
|
c.leaderUUID = uuid
|
||||||
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 1, nil)
|
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 1, nil)
|
||||||
}
|
}
|
||||||
@@ -715,6 +716,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop
|
|||||||
|
|
||||||
// Mark as standby
|
// Mark as standby
|
||||||
c.standby = true
|
c.standby = true
|
||||||
|
c.activeTime = time.Time{}
|
||||||
c.leaderUUID = ""
|
c.leaderUUID = ""
|
||||||
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 0, nil)
|
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 0, nil)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user