Skip to content

[OCP 5] Add networking permission on csv#842

Open
desmax74 wants to merge 2 commits into
trustification:release/3.y.zfrom
desmax74:network_policy_rbac_for_operands
Open

[OCP 5] Add networking permission on csv#842
desmax74 wants to merge 2 commits into
trustification:release/3.y.zfrom
desmax74:network_policy_rbac_for_operands

Conversation

@desmax74

@desmax74 desmax74 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Update RHTPA operator bundle to a newer release with additional networking permissions and refreshed testing metadata.

New Features:

  • Grant the operator permissions to manage Kubernetes NetworkPolicy resources.

Enhancements:

  • Bump the RHTPA operator image reference and version metadata to 2.2.5.

Build:

  • Update bundle annotations to use operator-sdk v1.42.2.

Tests:

  • Update operator scorecard test images to v1.42.2.

@sourcery-ai

sourcery-ai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the RHTPA operator bundle to a new operator/image version, adds Kubernetes NetworkPolicy RBAC permissions, and refreshes associated scorecard and metrics metadata tooling versions.

File-Level Changes

Change Details Files
Grant the operator RBAC permissions to manage Kubernetes NetworkPolicy resources.
  • Extend the ClusterServiceVersion RBAC rules with networking.k8s.io apiGroup access for networkpolicies.
  • Allow create, delete, and update verbs on networkpolicies to support operator-managed network policy lifecycle.
bundle/manifests/rhtpa-operator.clusterserviceversion.yaml
Update the operator image and product version referenced by the ClusterServiceVersion.
  • Bump the RHTPA product version in the CSV description from 2.2.3 to 2.2.5.
  • Point the operator deployment image to a new registry.redhat.io digest for the rhtpa-rhel9-operator.
bundle/manifests/rhtpa-operator.clusterserviceversion.yaml
Refresh scorecard test tooling and metrics builder metadata to newer operator-sdk versions.
  • Update all scorecard-test images from v1.40.0 to v1.42.2 in the scorecard config.
  • Align the bundle annotations metrics.builder value to operator-sdk-v1.42.2 to match the updated tooling version.
bundle/tests/scorecard/config.yaml
bundle/metadata/annotations.yaml

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

@desmax74 desmax74 changed the title Add netweorking permission on csv [OCP 5] Add networking permission on csv Jun 8, 2026
@desmax74
desmax74 requested a review from m-brophy June 8, 2026 10:29

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The new networking.k8s.io RBAC rules grant create/delete/update on NetworkPolicies; consider tightening these permissions to only the verbs actually needed and aligning their scope with the operator’s reconciliation pattern to preserve least-privilege.
  • The PR title contains a typo (“netweorking”); updating it for clarity will make the change history easier to scan later.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new networking.k8s.io RBAC rules grant create/delete/update on NetworkPolicies; consider tightening these permissions to only the verbs actually needed and aligning their scope with the operator’s reconciliation pattern to preserve least-privilege.
- The PR title contains a typo (“netweorking”); updating it for clarity will make the change history easier to scan later.

## Individual Comments

### Comment 1
<location path="bundle/manifests/rhtpa-operator.clusterserviceversion.yaml" line_range="307-314" />
<code_context>
                 - list
                 - watch
                 - delete
+            - apiGroups:
+                - networking.k8s.io
+              resources:
+                - networkpolicies
+              verbs:
+                - create
+                - delete
+                - update
             - apiGroups:
                 - batch
</code_context>
<issue_to_address>
**issue (bug_risk):** NetworkPolicy RBAC is missing read verbs, which may break typical controller reconcile flows

This rule for `networking.k8s.io` / `networkpolicies` only allows `create`, `delete`, and `update`. If the controller calls `Get`/`List`/`Watch` on NetworkPolicies, these requests will be denied and reconciles will fail. Please either add at least `get` (and likely `list`/`watch`) to this RBAC, or adjust the controller so it never reads NetworkPolicies if write-only access is intended.
</issue_to_address>

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.

Comment thread bundle/manifests/rhtpa-operator.clusterserviceversion.yaml
Signed-off-by: desmax74 <mdessi@redhat.com>
@desmax74
desmax74 force-pushed the network_policy_rbac_for_operands branch from 9a7e9b3 to 6692990 Compare June 8, 2026 10:39
@PhilipCattanach

Copy link
Copy Markdown

@desmax74 - This PR has some conflicts that need to be resolved.

@desmax74
desmax74 changed the base branch from release/2.y.z to release/3.y.z June 30, 2026 18:44
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.

2 participants