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

RateLimit.Conditions need explicit scope #1145

Merged
merged 1 commit into from
Jan 30, 2025
Merged

RateLimit.Conditions need explicit scope #1145

merged 1 commit into from
Jan 30, 2025

Conversation

alexsnaps
Copy link
Member

With Limitador v2.0, conditions need to specify where the variables are to be looked up. Variables coming from the envoy RLP are populated in the descriptors root binding. While the protocol allows for multiple descriptors (each with multiple entries), the wasm-shim will only ever use the first one, i.e. index 0.

Fixes #1144

With Limitador v2.0, conditions need to specify where the variables
are to be looked up. Variables coming from the envoy RLP are populated
in the `descriptors` root binding. While the protocol allows for
multiple descriptors (each with multiple entries), the wasm-shim will
only ever use the first one, i.e. index 0.

Signed-off-by: Alex Snaps <[email protected]>
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.37%. Comparing base (6df1dbf) to head (42d065f).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1145      +/-   ##
==========================================
+ Coverage   83.33%   83.37%   +0.04%     
==========================================
  Files          81       81              
  Lines        6943     6943              
==========================================
+ Hits         5786     5789       +3     
+ Misses        930      928       -2     
+ Partials      227      226       -1     
Flag Coverage Δ
bare-k8s-integration 22.68% <0.00%> (+0.01%) ⬆️
controllers-integration 74.94% <100.00%> (+0.11%) ⬆️
envoygateway-integration 40.36% <100.00%> (+0.04%) ⬆️
gatewayapi-integration 18.48% <0.00%> (-0.99%) ⬇️
istio-integration 43.37% <100.00%> (+0.07%) ⬆️
unit 19.57% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1beta1 (u) 90.00% <ø> (ø)
api/v1beta2 (u) ∅ <ø> (∅)
pkg/common (u) ∅ <ø> (∅)
pkg/istio (u) 62.06% <ø> (ø)
pkg/log (u) 93.18% <ø> (ø)
pkg/reconcilers (u) 24.67% <ø> (ø)
pkg/rlptools (u) ∅ <ø> (∅)
controllers (i) 86.63% <100.00%> (+0.02%) ⬆️
Files with missing lines Coverage Δ
controllers/limitador_limits_reconciler.go 86.31% <100.00%> (ø)

... and 7 files with indirect coverage changes

@alexsnaps alexsnaps self-assigned this Jan 29, 2025
@alexsnaps
Copy link
Member Author

Sorry Codecov, but you're on crack!

@@ -124,7 +124,7 @@ func (r *LimitadorLimitsReconciler) buildLimitadorLimits(ctx context.Context, st
Namespace: limitsNamespace,
MaxValue: maxValue,
Seconds: seconds,
Conditions: []string{fmt.Sprintf("%s == \"1\"", limitIdentifier)},
Conditions: []string{fmt.Sprintf("descriptors[0][\"%s\"] == \"1\"", limitIdentifier)},
Copy link
Member

@adam-cattermole adam-cattermole Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I remember seeing this in the limitador PR I approved but didn't connect the dots here

@alexsnaps alexsnaps added this pull request to the merge queue Jan 30, 2025
Merged via the queue into main with commit b9fb42b Jan 30, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Rate limits are not enforced anymore
2 participants