-
Notifications
You must be signed in to change notification settings - Fork 116
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
Refactor creation of prepared queries #604
Refactor creation of prepared queries #604
Conversation
9d006a5
to
8c49c01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good. We should add a note in the change log about the interface change so that we can include it in the release notes. Also do the existing tests exercise the new changes?
I will add a note to the changelog As for tests: they cover all changes, however there never was coverage for passing options to the Eval method, I will add a minimal test. We‘ll also integrate this in Skipper to do partial evaluation on prepare as an optimization. So we‘ll know how well the changed API works design wise… |
2716c31
to
3e3484a
Compare
Before this refactoring only the PreparedQuery options could be passed when using this plugin as a library. There are two more options (prepare options and evaluation options) that can be passed when using the OPA library directly. This change breaks the interface but also allows for extensibility of creating the prepared queries in the future. Signed-off-by: Magnus Jungsbluth <[email protected]>
3e3484a
to
1e06685
Compare
@ashutosh-narkar I added an item to the changelog and also added a test that verifies a user of a library can modify the existing behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @mjungsbluth!
The EvalContext interface is added with new CreatePreparedQueryOnce function and the signature of envoyauth.Eval(ctx, opa, inputValue, result) method used by Skipper were changed with in OPA v0.70.0 as a result of open-policy-agent/opa-envoy-plugin#604. The interface change is absorbed with no functional addition and just addressing successful compilation. Signed-off-by: Pushpalanka Jayawardhana <[email protected]>
The EvalContext interface is added with new CreatePreparedQueryOnce function and the signature of envoyauth.Eval(ctx, opa, inputValue, result) method used by Skipper were changed with in OPA v0.70.0 as a result of open-policy-agent/opa-envoy-plugin#604. The interface change is absorbed with no functional addition and just addressing successful compilation. Signed-off-by: Pushpalanka Jayawardhana <[email protected]>
Before this refactoring only the PreparedQuery options could be passed when using this plugin as a library. There are two more options (prepare options and evaluation options) that can be passed when using the OPA library directly.
This change breaks the interface but also allows for extensibility of creating the prepared queries in the future.