Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't touch ActiveTime in preSeal/postUnseal #24549

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/24549.txt
Original file line number Diff line number Diff line change
@@ -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.
```
2 changes: 0 additions & 2 deletions vault/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// for the active startup.
c.activeTime = time.Now().UTC()

if err := postUnsealPhysical(c); err != nil {
return err
Expand Down Expand Up @@ -2766,7 +2765,6 @@ func (c *Core) preSeal() error {
}
// Clear any pending funcs
c.postUnsealFuncs = nil
c.activeTime = time.Time{}

// Clear any rekey progress
c.barrierRekeyConfig = nil
Expand Down
2 changes: 2 additions & 0 deletions vault/ha.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop
err = c.postUnseal(activeCtx, activeCtxCancel, standardUnsealStrategy{})
if err == nil {
c.standby = false
c.activeTime = time.Now()
c.leaderUUID = uuid
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 1, nil)
}
Expand Down Expand Up @@ -715,6 +716,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop

// Mark as standby
c.standby = true
c.activeTime = time.Time{}
c.leaderUUID = ""
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 0, nil)

Expand Down
Loading