From 8d4b67d7c80f5c0e33c2ee2bc21d01ec5ebe0266 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 11 Dec 2020 15:19:55 -0500 Subject: [PATCH 1/3] rate limit: fix initialize defaults --- vault/quotas/quotas_rate_limit.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vault/quotas/quotas_rate_limit.go b/vault/quotas/quotas_rate_limit.go index fc5a499758bf..1899af6b07e4 100644 --- a/vault/quotas/quotas_rate_limit.go +++ b/vault/quotas/quotas_rate_limit.go @@ -138,6 +138,17 @@ func (rlq *RateLimitQuota) initialize(logger log.Logger, ms *metricsutil.Cluster rlq.ID = id } + // Set purgeInterval if coming from a previous version where purgeInterval was + // not defined. + if rlq.purgeInterval == 0 { + rlq.purgeInterval = DefaultRateLimitPurgeInterval + } + + // Set staleAge if coming from a previous version where staleAge was not defined. + if rlq.staleAge == 0 { + rlq.staleAge = DefaultRateLimitStaleAge + } + rlStore, err := memorystore.New(&memorystore.Config{ Tokens: uint64(math.Round(rlq.Rate)), // allow 'rlq.Rate' number of requests per 'Interval' Interval: rlq.Interval, // time interval in which to enforce rate limiting From 726e3aaf6f36622e818e2dd032c53a09b2ad8605 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 14 Dec 2020 13:50:04 -0500 Subject: [PATCH 2/3] cl++ --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb3e0048bae..0f0cd38605a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ BUG FIXES: * core: Fix client.Clone() to include the address [[GH-10077](https://github.com/hashicorp/vault/pull/10077)] +* core: Fix rate limit resource quota migration from 1.5.x to 1.6.x [[GH-10536](https://github.com/hashicorp/vault/pull/10536)] ## 1.6.0 ### November 11th, 2020 From 0b2f4c59633dbafac50f107a622e608d4b22648b Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 14 Dec 2020 14:25:23 -0500 Subject: [PATCH 3/3] cl++ --- CHANGELOG.md | 1 - changelog/10536.txt | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/10536.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f0cd38605a1..0fb3e0048bae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,6 @@ BUG FIXES: * core: Fix client.Clone() to include the address [[GH-10077](https://github.com/hashicorp/vault/pull/10077)] -* core: Fix rate limit resource quota migration from 1.5.x to 1.6.x [[GH-10536](https://github.com/hashicorp/vault/pull/10536)] ## 1.6.0 ### November 11th, 2020 diff --git a/changelog/10536.txt b/changelog/10536.txt new file mode 100644 index 000000000000..483b823b21e0 --- /dev/null +++ b/changelog/10536.txt @@ -0,0 +1,4 @@ +```release-note:bug +core: Fix rate limit resource quota migration from 1.5.x to 1.6.x by ensuring `purgeInterval` and +`staleAge` are set appropriately. +```