Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0dfd66f
feat: support weekly, monthly, and yearly quota windows
Sep 9, 2026
952a894
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 16, 2026
9ac803d
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 17, 2026
f6c81ff
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 18, 2026
3e3cb99
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 20, 2026
47c8cdc
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 22, 2026
5ce6b2a
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 24, 2026
b9d1c7d
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 28, 2026
8f2b7f7
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 28, 2026
d509667
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 30, 2026
fe13d0d
Merge branch 'main' into feat/quota-windows
fernandoescolar Sep 30, 2026
103334a
chore: regenerate CRDs and docs for new quota windows
Oct 1, 2026
92d73fd
Merge branch 'main' into feat/quota-windows
fernandoescolar Oct 1, 2026
5fb5a5f
Merge branch 'main' into feat/quota-windows
fernandoescolar Oct 4, 2026
6776a6d
Merge branch 'main' into feat/quota-windows
fernandoescolar Oct 5, 2026
57944c5
Merge branch 'main' into feat/quota-windows
fernandoescolar Oct 6, 2026
4f20ac1
Merge branch 'main' into feat/quota-windows
aabchoo Oct 6, 2026
cf27e0b
Merge branch 'main' into feat/quota-windows
fernandoescolar Oct 7, 2026
6f42e0c
Merge branch 'main' into feat/quota-windows
aabchoo Oct 7, 2026
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
4 changes: 2 additions & 2 deletions api/v1alpha1/quota_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ type QuotaRule struct {
type QuotaValue struct {
// The limit alloted for a specified time window.
Limit uint `json:"limit"`
// Time window. Must be exactly one of: "1s" (1 second), "1m" (1 minute), "1h" (1 hour), or "1d" (1 day).
// Time window. Must be exactly one of: "1s" (1 second), "1m" (1 minute), "1h" (1 hour), "1d" (1 day), "1w" (1 week), "1mo" (1 month), or "1y" (1 year).
//
// +kubebuilder:validation:Enum="1s";"1m";"1h";"1d"
// +kubebuilder:validation:Enum="1s";"1m";"1h";"1d";"1w";"1mo";"1y"
Duration string `json:"duration"`
}

Expand Down
10 changes: 8 additions & 2 deletions internal/ratelimit/translator/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func quotaValueToPolicy(qv *aigv1a1.QuotaValue) (*rlsconfv3.RateLimitPolicy, err
}, nil
}

// parseDuration accepts exactly "1s", "1m", "1h", or "1d".
// parseDuration accepts exactly "1s", "1m", "1h", "1d", "1w", "1mo", or "1y".
func parseDuration(s string) (rlsconfv3.RateLimitUnit, error) {
switch s {
case "1s":
Expand All @@ -411,8 +411,14 @@ func parseDuration(s string) (rlsconfv3.RateLimitUnit, error) {
return rlsconfv3.RateLimitUnit_HOUR, nil
case "1d":
return rlsconfv3.RateLimitUnit_DAY, nil
case "1w":
return rlsconfv3.RateLimitUnit_WEEK, nil
case "1mo":
return rlsconfv3.RateLimitUnit_MONTH, nil
case "1y":
return rlsconfv3.RateLimitUnit_YEAR, nil
default:
return 0, fmt.Errorf("unsupported duration %q: must be one of 1s, 1m, 1h", s)
return 0, fmt.Errorf("unsupported duration %q: must be one of 1s, 1m, 1h, 1d, 1w, 1mo, 1y", s)
}
}

Expand Down
4 changes: 4 additions & 0 deletions internal/ratelimit/translator/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func TestParseDuration(t *testing.T) {
{"1 second", "1s", rlsconfv3.RateLimitUnit_SECOND, false},
{"1 minute", "1m", rlsconfv3.RateLimitUnit_MINUTE, false},
{"1 hour", "1h", rlsconfv3.RateLimitUnit_HOUR, false},
{"1 day", "1d", rlsconfv3.RateLimitUnit_DAY, false},
{"1 week", "1w", rlsconfv3.RateLimitUnit_WEEK, false},
{"1 month", "1mo", rlsconfv3.RateLimitUnit_MONTH, false},
{"1 year", "1y", rlsconfv3.RateLimitUnit_YEAR, false},
{"30 seconds rejected", "30s", 0, true},
{"5 minutes rejected", "5m", 0, true},
{"2 hours rejected", "2h", 0, true},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,16 @@ spec:
duration:
description: 'Time window. Must be exactly one
of: "1s" (1 second), "1m" (1 minute), "1h" (1
hour), or "1d" (1 day).'
hour), "1d" (1 day), "1w" (1 week), "1mo" (1
month), or "1y" (1 year).'
enum:
- 1s
- 1m
- 1h
- 1d
- 1w
- 1mo
- 1y
type: string
limit:
description: The limit alloted for a specified
Expand Down Expand Up @@ -334,13 +338,16 @@ spec:
properties:
duration:
description: 'Time window. Must be exactly one of: "1s"
(1 second), "1m" (1 minute), "1h" (1 hour), or "1d"
(1 day).'
(1 second), "1m" (1 minute), "1h" (1 hour), "1d" (1
day), "1w" (1 week), "1mo" (1 month), or "1y" (1 year).'
enum:
- 1s
- 1m
- 1h
- 1d
- 1w
- 1mo
- 1y
type: string
limit:
description: The limit alloted for a specified time
Expand Down Expand Up @@ -390,12 +397,16 @@ spec:
properties:
duration:
description: 'Time window. Must be exactly one of: "1s" (1
second), "1m" (1 minute), "1h" (1 hour), or "1d" (1 day).'
second), "1m" (1 minute), "1h" (1 hour), "1d" (1 day), "1w"
(1 week), "1mo" (1 month), or "1y" (1 year).'
enum:
- 1s
- 1m
- 1h
- 1d
- 1w
- 1mo
- 1y
type: string
limit:
description: The limit alloted for a specified time window.
Expand Down
2 changes: 1 addition & 1 deletion site/docs/api/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2580,7 +2580,7 @@ QuotaValue defines the quota limits using sliding window.
name="duration"
type="string"
required="true"
description="Time window. Must be exactly one of: `1s` (1 second), `1m` (1 minute), `1h` (1 hour), or `1d` (1 day)."
description="Time window. Must be exactly one of: `1s` (1 second), `1m` (1 minute), `1h` (1 hour), `1d` (1 day), `1w` (1 week), `1mo` (1 month), or `1y` (1 year)."
/>


Expand Down
15 changes: 9 additions & 6 deletions site/docs/capabilities/traffic/quota-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,15 @@ Shadow mode is configured per bucket rule. It cannot be set on the `defaultBucke

The `duration` field selects the sliding-window size. It must be exactly one of the following values:

| Value | Window |
| ------ | ---------- |
| `"1s"` | One second |
| `"1m"` | One minute |
| `"1h"` | One hour |
| `"1d"` | One day |
| Value | Window |
| ------- | ---------- |
| `"1s"` | One second |
| `"1m"` | One minute |
| `"1h"` | One hour |
| `"1d"` | One day |
| `"1w"` | One week |
| `"1mo"` | One month |
| `"1y"` | One year |

The window is fixed-size — arbitrary multiples such as `"30s"` or `"15m"` are **not** valid and will
be rejected by the CRD schema. Choose the `limit` to express your budget within one of these windows.
Expand Down
Loading