Skip to content

feat: Adding pubsub interface#2538

Merged
sozercan merged 25 commits into
open-policy-agent:masterfrom
JaydipGabani:pubsub
May 25, 2023
Merged

feat: Adding pubsub interface#2538
sozercan merged 25 commits into
open-policy-agent:masterfrom
JaydipGabani:pubsub

Conversation

@JaydipGabani
Copy link
Copy Markdown
Contributor

@JaydipGabani JaydipGabani commented Jan 25, 2023

Signed-off-by: Jaydip Gabani gabanijaydip@gmail.com

What this PR does / why we need it: This PR introduces a way to export violations and provides a way to consume all the violations without scanning the logs. For more details, please refer to this doc

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #

Special notes for your reviewer:

@JaydipGabani
Copy link
Copy Markdown
Contributor Author

Open questions:

  1. Should we include a way for us to batch the messages in the interface itself, or rely on the batching mechanism of individual underlying tools?
  2. How to implement per-request routing based on the relevant queues, for different enforcement actions?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 25, 2023

Codecov Report

❌ Patch coverage is 16.51376% with 182 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.87%. Comparing base (9da7226) to head (1319b9e).
⚠️ Report is 624 commits behind head on master.

Files with missing lines Patch % Lines
pkg/controller/pubsub/pubsub_config_controller.go 11.68% 66 Missing and 2 partials ⚠️
pkg/pubsub/system.go 3.92% 49 Missing ⚠️
pkg/audit/manager.go 0.00% 33 Missing ⚠️
pkg/pubsub/dapr/dapr.go 23.80% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2538      +/-   ##
==========================================
- Coverage   53.56%   52.87%   -0.69%     
==========================================
  Files         128      132       +4     
  Lines       11411    11629     +218     
==========================================
+ Hits         6112     6149      +37     
- Misses       4822     5001     +179     
- Partials      477      479       +2     
Flag Coverage Δ
unittests 52.87% <16.51%> (-0.69%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread pkg/pubsub/pubsub_client.go Outdated
@JaydipGabani
Copy link
Copy Markdown
Contributor Author

Here is a PR I came across that defined method definition for batching in dapr. This is a complete proposal for batching in dapr pub sub

@JaydipGabani
Copy link
Copy Markdown
Contributor Author

@maxsmythe according to this PPT, it seems I was wrong and at least with dapr, the subscriber will have a choice of bulk subscribe or simple subscribe (i.e how the subscriber can get messages).

@maxsmythe
Copy link
Copy Markdown
Contributor

It looks like Dapr's response to the possibility of some clients not supporting bulk publishing is to have their library turn a bulk publish into a loop over the non-supporting client's publish call.

@JaydipGabani
Copy link
Copy Markdown
Contributor Author

Yes! According to this comment, non-supporting client's publish call can be made either parallelly or serially (by default it will be made parallelly

Comment thread pkg/pubsub/pubsub_client.go Outdated
Comment thread pkg/pubsub/rabbitmq/rabbitmq.go Outdated
Comment thread pkg/pubsub/pubsub_client.go Outdated
Comment thread pkg/pubsub/pubsub_client.go Outdated
@JaydipGabani JaydipGabani force-pushed the pubsub branch 2 times, most recently from d200ae9 to 1440f84 Compare February 8, 2023 19:21
Comment thread pkg/pubsub/dapr/dapr.go Outdated
@davis-haba
Copy link
Copy Markdown
Contributor

We want to add this to the validation webhook too, right? Or did you plan to do this as a follow up?

@JaydipGabani
Copy link
Copy Markdown
Contributor Author

We want to add this to the validation webhook too, right? Or did you plan to do this as a follow up?

Initially we will enable this with audit and then, later on, can integrate to different parts such as validation webhook.

@JaydipGabani JaydipGabani marked this pull request as ready for review February 9, 2023 01:32
@JaydipGabani
Copy link
Copy Markdown
Contributor Author

JaydipGabani commented Feb 9, 2023

@sozercan @maxsmythe @nilekhc @ritazh I am working on fixing CI errors, but this PR is ready for review

Copy link
Copy Markdown
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, added a few comments.

Comment thread pkg/pubsub/pubsub_client.go Outdated
Comment thread pkg/pubsub/dapr/dapr.go Outdated
Comment thread pkg/pubsub/pubsub_client.go Outdated
Comment thread pkg/pubsub/pubsub_client.go Outdated
Comment thread pkg/pubsub/pubsub_init.go Outdated
Comment thread pkg/pubsub/pubsub_client.go Outdated
@JaydipGabani JaydipGabani force-pushed the pubsub branch 2 times, most recently from c92a982 to 6320696 Compare February 14, 2023 23:25
Comment thread pkg/pubsub/dapr/dapr.go Outdated
Comment thread pkg/pubsub/pubsub_init.go Outdated
Comment thread pkg/pubsub/pubsub_init.go Outdated
Comment thread pkg/pubsub/pubsub_init.go Outdated
Comment thread pkg/pubsub/client/pubsub_client.go Outdated
Comment thread pkg/audit/manager.go Outdated
@JaydipGabani JaydipGabani requested a review from maxsmythe May 18, 2023 21:44
Copy link
Copy Markdown
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

Code LGTM, last nit is on the Helm chart

Comment thread charts/gatekeeper/values.yaml Outdated
@JaydipGabani JaydipGabani requested a review from maxsmythe May 22, 2023 17:33
@JaydipGabani
Copy link
Copy Markdown
Contributor Author

@maxsmythe @sozercan made the change, PTAL.

Copy link
Copy Markdown
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants