-
Notifications
You must be signed in to change notification settings - Fork 60
policy-engine: add TOML configuration for policy plugins #129
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
Conversation
steveej
left a comment
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.
Preliminary review pass with a few high-level comments.
cincinnati/src/plugins/mod.rs
Outdated
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.
This is pretty ugly. Do you see any chance we don't need this?
Why do we need this trait for BoxedPlugin?
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.
This is used (so far exactly once) in tests: https://github.com/openshift/cincinnati/pull/129/files#diff-abed32e590a01cf6f55fd42829e13404R159.
This is indeed pretty ugly. However trait object safety rules disallow any use of generics (which PartialEq has), so we can't just require/use the implementation from underlying real type. Similar consideration for Serialize. Instead, Debug contains no generics, so it works here.
The only improvement I can think of here is to make this #[cfg(test)], as I think we are not going to use it outside of tests.
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 only improvement I can think of here is to make this
#[cfg(test)], as I think we are not going to use it outside of tests.
That seems like a reasonable workaround. You could even pull the impl into the tests module.
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.
Bad news: the consumer of this is in a separate crate, so neither of the two approaches above work (as the cfg(test) affects the top-level crate, not the dependencies).
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.
That's unfortunate. So we can only place a sentence in the docstring that it's only used for testing but we can't statically enforce that right now.
|
Amended, PTAL. |
commons/src/config.rs
Outdated
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.
Do you mind explaining why you would like to have a separate trait for this? It would also work to have a blanket implementation of try_merge in the MergeOptions<T> trait with just Ok(self.merge(T)).
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.
Discussed out of band: let's unify and just keep a single trait (the fallible one).
This adds an addition type alias to help consumers which need to store/handle/compare policy plugins.
This tweaks the `MergeOptions` in order to support fallible operations, for merging configuration snippets that require further processing.
This adds logic and basic tests to source policy plugins settings from TOML configuration file.
|
@steveej rebased to latest master and addressed all comments, PTAL. |
steveej
left a comment
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.
This
/lgtm
But putting it on
/hold
to give you another opportunity to dig for a solution to the PartiqlEq workaround. Feel free to cancel the hold on your own accord.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lucab, steveeJ The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
I looked a bit more into /hold cancel |
This adds logic and basic tests to source policy plugins settings
from TOML configuration file.
Ref: https://jira.coreos.com/browse/CIN-3