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

Disallow querying of activity APIs during upgrade #29154

Merged
merged 1 commit into from
Dec 11, 2024
Merged
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
17 changes: 17 additions & 0 deletions vault/logical_system_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const (

// WarningCurrentMonthIsAnEstimate is a warning string that is used to let the customer know that for this query, the current month's data is estimated.
WarningCurrentMonthIsAnEstimate = "Since this usage period includes both the current month and at least one historical month, counts returned in this usage period are an estimate. Client counts for this period will no longer be estimated at the start of the next month."

ErrorUpgradeInProgress = "Upgrade to 1.19+ is in progress; the activity log is not queryable until the upgrade is complete"
)

// activityQueryPath is available in every namespace
Expand Down Expand Up @@ -293,6 +295,9 @@ func (b *SystemBackend) handleClientExport(ctx context.Context, req *logical.Req
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

startTime, endTime, err := parseStartEndTimes(d, b.Core.BillingStart())
if err != nil {
Expand Down Expand Up @@ -339,6 +344,9 @@ func (b *SystemBackend) handleClientMetricQuery(ctx context.Context, req *logica
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

warnings := make([]string, 0)

Expand Down Expand Up @@ -385,6 +393,9 @@ func (b *SystemBackend) handleMonthlyActivityCount(ctx context.Context, req *log
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

results, err := a.partialMonthClientCount(ctx)
if err != nil {
Expand All @@ -406,6 +417,9 @@ func (b *SystemBackend) handleActivityConfigRead(ctx context.Context, req *logic
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

config, err := a.loadConfigOrDefault(ctx)
if err != nil {
Expand Down Expand Up @@ -440,6 +454,9 @@ func (b *SystemBackend) handleActivityConfigUpdate(ctx context.Context, req *log
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

warnings := make([]string, 0)

Expand Down
Loading