-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: Provider to load rule sets from cloud blobs #283
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… as well as the new rule path prefix validation functionality
dadrus
changed the title
feat: Provider to load rule sets from cloud blobs
wip: Provider to load rule sets from cloud blobs
Oct 22, 2022
… and to include the configuration presence check
Codecov Report
@@ Coverage Diff @@
## main #283 +/- ##
==========================================
+ Coverage 85.92% 86.18% +0.26%
==========================================
Files 164 172 +8
Lines 6863 7161 +298
==========================================
+ Hits 5897 6172 +275
- Misses 826 844 +18
- Partials 140 145 +5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…by the dependencies
…n s3 mock is used for tests
dadrus
changed the title
wip: Provider to load rule sets from cloud blobs
feat: Provider to load rule sets from cloud blobs
Nov 3, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #84
closes #85
closes #282
This PR enables loading of rule sets from cloud blobs. Following new property with following configuration options is available under
rules.provider
:By default the
watch_interval
is disabled (set to 0), which means the communication to the configured buckets happens only once. The configuration of the buckets within thebucket
property supportsurl
(required) to load the blobs from,prefix
, which indicates that only blobs with a key starting with this prefix should be retrieved, andrules_path_prefix
, which can be used to create kind of a namespace for the rule sets retrieved from the blobs stored in the corresponding buckets. If set, the provider checks whether the urls specified in all rules retrieved from the referenced bucket have the defined path prefix. If that rule is violated, a warning is emitted and the rule set is ignored. This can be used to ensure a rule retrieved from one endpoint does not override a rule from another endpoint.This provider supports rule sets in yaml, as well as in json format. The differentiation happens based on the
Content-Type
set in the blob meta data. Ifapplication/yaml
orapplication/json
is set, the body of the response is read using a yaml, respectively a json parser, otherwise an error is logged and the response from the endpoint is ignored.The implementation uses Go CDK - Blob and supports AWS S3, Google Cloud Storage, as well as Azure Blobs. Implementations, which are compatible with the corresponding APIs are supported as well. Examples can be found in the referenced documentation.
The loading and removal of rules happens as follows:
TODOs: