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

Add classifiers to flowcontrolv1.CheckResponse #310

Merged
merged 2 commits into from
Sep 8, 2022
Merged

Add classifiers to flowcontrolv1.CheckResponse #310

merged 2 commits into from
Sep 8, 2022

Conversation

DariaKunoichi
Copy link
Contributor

@DariaKunoichi DariaKunoichi commented Sep 2, 2022

This change is Reviewable

@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

Base: 48.79% // Head: 48.81% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (d673c5b) compared to base (dd77ac5).
Patch has no changes to coverable lines.

❗ Current head d673c5b differs from pull request most recent head 13ecedd. Consider uploading reports for the commit 13ecedd to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
+ Coverage   48.79%   48.81%   +0.02%     
==========================================
  Files         246      246              
  Lines       19161    19176      +15     
==========================================
+ Hits         9349     9361      +12     
- Misses       9194     9197       +3     
  Partials      618      618              
Impacted Files Coverage Δ
pkg/info/info.go 49.09% <0.00%> (-15.32%) ⬇️
pkg/policies/dataplane/engine.go 65.04% <0.00%> (-0.43%) ⬇️
pkg/policies/controlplane/provider.go 0.00% <0.00%> (ø)
.../policies/dataplane/actuators/rate/rate-limiter.go 0.00% <0.00%> (ø)
...plane/actuators/concurrency/concurrency-limiter.go 0.00% <0.00%> (ø)
pkg/platform/platform.go 56.19% <0.00%> (+0.36%) ⬆️
pkg/jobs/job.go 86.99% <0.00%> (+2.43%) ⬆️
pkg/config/log.go 61.44% <0.00%> (+3.11%) ⬆️
pkg/policies/mocks/mock_limiter.go 69.44% <0.00%> (+3.65%) ⬆️
pkg/config/zz_generated.deepcopy.go 12.50% <0.00%> (+3.80%) ⬆️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@IridiumOxide IridiumOxide marked this pull request as ready for review September 6, 2022 05:13
@IridiumOxide IridiumOxide requested review from a team as code owners September 6, 2022 05:13
Copy link
Contributor

@kwapik kwapik left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 15 files at r1, 2 of 3 files at r2, 16 of 16 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @DariaKunoichi)

@tanveergill
Copy link
Contributor

@kwapik, you would need this change for flow analytics dashboard on Classifiers resource page, please prioritize before Sept 12th

@IridiumOxide IridiumOxide force-pushed the GH-268 branch 3 times, most recently from 0874711 to 2a91ca0 Compare September 7, 2022 02:01
Copy link
Contributor

@kwapik kwapik left a comment

Choose a reason for hiding this comment

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

Reviewed 22 of 22 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @DariaKunoichi)

@IridiumOxide IridiumOxide force-pushed the GH-268 branch 2 times, most recently from 5fb2438 to 1df2419 Compare September 7, 2022 23:07
Copy link
Contributor

@sbienkow-ninja sbienkow-ninja left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 24 files at r6, 2 of 20 files at r7, all commit messages.
Reviewable status: 6 of 29 files reviewed, 1 unresolved discussion (waiting on @DariaKunoichi and @kwapik)

@IridiumOxide IridiumOxide merged commit 79ad85f into main Sep 8, 2022
@IridiumOxide IridiumOxide deleted the GH-268 branch September 8, 2022 09:10
harjotgill pushed a commit that referenced this pull request Sep 9, 2022
* Add classifiers to flowcontrolv1.CheckResponse
* Add classifier index to classifier ID

Closes: GH-268

Co-authored-by: Filip Chmielewski <[email protected]>
if err != nil {
return err
}

// Register metric with PCA
err = engineAPI.RegisterClassifier(classifier)
Copy link
Contributor

@tanveergill tanveergill Sep 14, 2022

Choose a reason for hiding this comment

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

@DariaKunoichi,

This implementation is incorrect. Classifier runs in the Authz stage. And it may manipulate the labels. By the time engine runs, the labels are already mutated so it might not give the same results. On top of that we are unnecessarily running multi matcher for Classifiers twice.

The matched Classifiers should be encoded in flowcontrol.AuthzResult (I'll be renaming it from AuthzResponse)

cc: @krdln

activeRulesets map[rulesetID]CompiledRuleset // protected by mu
nextRulesetID rulesetID // protected by mu
classifierProto *classificationv1.Classifier
policyName string
Copy link
Contributor

@tanveergill tanveergill Sep 15, 2022

Choose a reason for hiding this comment

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

@DariaKunoichi,

Classifier is a singleton, it is not being created per Policy.Classifiers[i]

cc: @krdln

Comment on lines +125 to +129
rs := wrapperMessage.Classifier
classifier.classifierProto = rs
classifier.policyName = wrapperMessage.PolicyName
classifier.policyHash = wrapperMessage.PolicyHash
classifier.classifierIndex = wrapperMessage.ClassifierIndex
Copy link
Contributor

Choose a reason for hiding this comment

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

This will just overwrite the values in the singleton Classifier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants