Skip to content

Conversation

@osmman
Copy link
Collaborator

@osmman osmman commented Aug 11, 2025

Summary by Sourcery

Remove automatic creation of RBAC roles and bindings for the prometheus-k8s service account and update sample configurations accordingly

Bug Fixes:

  • Remove Role and RoleBinding provisioning for prometheus-k8s in all monitoring actions
  • Prune pod and endpoint watch rules from the operator’s cluster role

Enhancements:

  • Strip out unused rbac/v1 and reconcile imports in monitoring controllers

Documentation:

  • Add monitoring enabled flags to sample CRs for trillian and ctlog

@osmman osmman added the bug Something isn't working label Aug 11, 2025
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 11, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR streamlines monitoring setup by removing explicit Role/RoleBinding creation for the Prometheus service account across controllers, adjusts cluster RBAC to drop redundant watch permissions, updates deployment config, and enables monitoring by default in sample CRs.

Entity relationship diagram for RBAC changes (Role/RoleBinding removal)

erDiagram
  PROMETHEUS_K8S_SERVICE_ACCOUNT ||--o{ ROLE : "was bound by"
  PROMETHEUS_K8S_SERVICE_ACCOUNT ||--o{ ROLE_BINDING : "was bound by"
  ROLE ||--o{ ROLE_BINDING : "referenced by"
  ROLE_BINDING {
    string name
    string namespace
    string roleRef
    string subject
  }
  ROLE {
    string name
    string namespace
    PolicyRule[] rules
  }
  PROMETHEUS_K8S_SERVICE_ACCOUNT {
    string name
    string namespace
  }
  %% These relationships are now removed
Loading

Class diagram for monitoring action changes in controllers

classDiagram
  class monitoringAction {
    +Handle(ctx, instance)
    -Role creation logic (removed)
    -RoleBinding creation logic (removed)
    +ServiceMonitor creation logic
  }
  monitoringAction <|-- RekorMonitoringAction
  monitoringAction <|-- ServerMonitoringAction
  monitoringAction <|-- CTlogMonitoringAction
  monitoringAction <|-- FulcioMonitoringAction
  monitoringAction <|-- TSAMonitoringAction
  monitoringAction <|-- TrillianLogServerMonitoringAction
  monitoringAction <|-- TrillianLogSignerMonitoringAction
Loading

File-Level Changes

Change Details Files
Remove explicit RBAC objects for prometheus-k8s
  • Deleted Role and RoleBinding creation blocks
  • Removed rbac/v1 and reconcile imports
internal/controller/rekor/actions/monitor/monitoring.go
internal/controller/rekor/actions/server/monitoring.go
internal/controller/ctlog/actions/monitoring.go
internal/controller/fulcio/actions/monitoring.go
internal/controller/tsa/actions/monitoring.go
internal/controller/trillian/actions/logserver/monitoring.go
internal/controller/trillian/actions/logsigner/monitoring.go
Prune cluster role rules
  • Removed endpoints and pods watch/get/list rule
config/rbac/role.yaml
Update operator image reference
  • Changed manager image newName to quay.io/osmman/securesign-operator
  • Set image newTag to latest
config/manager/kustomization.yaml
Enable monitoring in sample CRs
  • Added monitoring.enabled: true under trillian
  • Added monitoring.enabled: true under ctlog
config/samples/rhtas_v1alpha1_securesign.yaml
Clean up obsolete kubebuilder markers
  • Removed pods and endpoints RBAC comments
internal/controller/types.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @osmman - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@osmman osmman force-pushed the tturek/remove-rbac-promethes-sa branch from dd682e6 to e2806e0 Compare August 11, 2025 09:41
@osmman
Copy link
Collaborator Author

osmman commented Aug 11, 2025

@sourcery-ai title

@osmman
Copy link
Collaborator Author

osmman commented Aug 11, 2025

@sourcery-ai summary

@sourcery-ai sourcery-ai bot changed the title fix: do not create roles for prometheus-k8s service account Fix: Remove prometheus-k8s RBAC and prune watch rules Aug 11, 2025
@osmman osmman requested review from JasonPowr and bouskaJ August 11, 2025 10:33
@osmman osmman merged commit 6047fb0 into main Aug 11, 2025
19 checks passed
@osmman osmman deleted the tturek/remove-rbac-promethes-sa branch August 11, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants