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

fix: Let pubsub config controller only watch specified configmap #2959

Closed
wants to merge 2 commits into from

Conversation

Mattes83
Copy link
Contributor

Signed-off-by: Matthias Teich [email protected]

What this PR does / why we need it:
Currently the pubsub config controller logs errors about every configmap located in the gatekeeper namespace which does not have a provider field. This should be limited to the configmap which is configured via audit-connection flag.

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:

@maxsmythe
Copy link
Contributor

Thanks for the PR!

This works for the current story of "pubsub only for audit", but will get more complicated when we allow multiple pubsub configs.

@JaydipGabani this is another argument for having a dedicated K8s kind for configuring pubsub (in addition to RBAC and avoiding unnecessary caching of configmaps). Is that something we are working on?

@Mattes83
Copy link
Contributor Author

Mattes83 commented Aug 18, 2023

I guess using a CRD here is a good idea!
The CR could reference a secret for connection credentials. Currently for eg a RabbitMQ Stream I'd have to write a connectionstring with credentials into a configmap.

@JaydipGabani
Copy link
Contributor

Thanks for the PR!

This works for the current story of "pubsub only for audit", but will get more complicated when we allow multiple pubsub configs.

@JaydipGabani this is another argument for having a dedicated K8s kind for configuring pubsub (in addition to RBAC and avoiding unnecessary caching of configmaps). Is that something we are working on?

I am not actively working on this right now, but we can discuss this again in a community meeting and figure out a road map from there if we want to. I have opened up an issue for this one though - #2802

@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (f905e30) 52.51% compared to head (3e6f97d) 52.57%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2959      +/-   ##
==========================================
+ Coverage   52.51%   52.57%   +0.05%     
==========================================
  Files         134      134              
  Lines       11886    11886              
==========================================
+ Hits         6242     6249       +7     
+ Misses       5154     5149       -5     
+ Partials      490      488       -2     
Flag Coverage Δ
unittests 52.57% <0.00%> (+0.05%) ⬆️

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

Files Coverage Δ
pkg/audit/manager.go 9.83% <0.00%> (ø)
pkg/controller/pubsub/pubsub_config_controller.go 12.50% <0.00%> (ø)

... and 1 file with indirect coverage changes

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

@ritazh
Copy link
Member

ritazh commented Aug 25, 2023

Per last community call, we want to support pubsub configs as a CRD eventually, but in the meantime, let's get this PR reviewed and merged first to reduce impact on users.

@@ -89,16 +92,16 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
&handler.EnqueueRequestForObject{},
predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool {
return e.Object.GetNamespace() == util.GetNamespace()
return e.Object.GetNamespace() == util.GetNamespace() && e.Object.GetName() == *AuditConnection
Copy link
Member

Choose a reason for hiding this comment

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

Please check nil before dereferencing
e.g. AuditConnection != nil && e.Object.GetName() == *AuditConnection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I rebased and added the nil checks

@JaydipGabani
Copy link
Contributor

@Mattes83 Please signoff commits to resolve CI error to merge the PR

@sozercan
Copy link
Member

ping @Mattes83

@Mattes83 Mattes83 requested a review from a team as a code owner October 25, 2023 08:01
@ritazh ritazh added this to the v3.15.0 milestone Oct 25, 2023
@sozercan
Copy link
Member

@Mattes83 looks like DCO is missing, can you add this when you get a chance please? https://open-policy-agent.github.io/gatekeeper/website/docs/help/#developer-certification-of-origin-dco

@salaxander salaxander removed this from the v3.15.0 milestone Dec 13, 2023
Copy link

stale bot commented Feb 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 13, 2024
@ritazh
Copy link
Member

ritazh commented Feb 13, 2024

@Mattes83 are you still interested in this PR? How can we help?

@stale stale bot removed the stale label Feb 13, 2024
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.

7 participants