Skip to content

🐛 Add addon v1beta1 to supported type for grpc - #216

Merged
openshift-merge-bot[bot] merged 1 commit into
open-cluster-management-io:mainfrom
qiujian16:add-v1beta1
Mar 17, 2026
Merged

🐛 Add addon v1beta1 to supported type for grpc#216
openshift-merge-bot[bot] merged 1 commit into
open-cluster-management-io:mainfrom
qiujian16:add-v1beta1

Conversation

@qiujian16

@qiujian16 qiujian16 commented Mar 17, 2026

Copy link
Copy Markdown
Member

Summary

Related issue(s)

Fixes #

Summary by CodeRabbit

  • Bug Fixes
    • Extended authorization handling for add-on events to support both alpha and beta versions of the add-on API, ensuring consistent access control validation across all event types.

Signed-off-by: Jian Qiu <jqiu@redhat.com>
@openshift-ci
openshift-ci Bot requested a review from deads2k March 17, 2026 08:13
@openshift-ci

openshift-ci Bot commented Mar 17, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Mar 17, 2026

Copy link
Copy Markdown

Walkthrough

This PR adds support for the v1beta1 version of ManagedClusterAddOn event data types in Subject Access Review (SAR) handling. An import for addon/v1beta1 is added, and the case analysis in toSubjectAccessReview is extended to recognize v1beta1.ManagedClusterAddOnEventDataType alongside the existing v1alpha1 variant.

Changes

Cohort / File(s) Summary
Add-on v1beta1 SAR Support
pkg/cloudevents/server/grpc/authz/kube/sar.go
Extended case analysis to handle v1beta1.ManagedClusterAddOnEventDataType in subject access review logic, applying same resource attributes as v1alpha1 variant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • deads2k
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is mostly empty template text with no summary or context provided, lacking the required Summary and Related issue(s) sections with actual content. Fill in the Summary section to explain why v1beta1 support was added and any impact; add Related issue(s) reference if applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding addon v1beta1 support for gRPC, which aligns with the file modifications adding v1beta1 imports and type handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
pkg/cloudevents/server/grpc/authz/kube/sar.go (1)

221-223: Add a unit test for the new v1beta1 SAR path.

Please add/extend toSubjectAccessReview tests to assert that v1beta1.ManagedClusterAddOnEventDataType resolves to the expected ResourceAttributes (group/resource/namespace) to prevent regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/cloudevents/server/grpc/authz/kube/sar.go` around lines 221 - 223, Add a
unit test case to the existing toSubjectAccessReview tests that covers the new
v1beta1 path: ensure that when input event type is
v1beta1.ManagedClusterAddOnEventDataType the toSubjectAccessReview function
produces the expected ResourceAttributes (group, resource, namespace) for the
SAR; update the test table/cases in the toSubjectAccessReview test suite to
include an entry for v1beta1.ManagedClusterAddOnEventDataType with the exact
expected Group, Resource and Namespace values and assert equality against the
returned SubjectAccessReview.ResourceAttributes to prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/cloudevents/server/grpc/authz/kube/sar.go`:
- Around line 221-223: Add a unit test case to the existing
toSubjectAccessReview tests that covers the new v1beta1 path: ensure that when
input event type is v1beta1.ManagedClusterAddOnEventDataType the
toSubjectAccessReview function produces the expected ResourceAttributes (group,
resource, namespace) for the SAR; update the test table/cases in the
toSubjectAccessReview test suite to include an entry for
v1beta1.ManagedClusterAddOnEventDataType with the exact expected Group, Resource
and Namespace values and assert equality against the returned
SubjectAccessReview.ResourceAttributes to prevent regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1840604a-d7dd-489c-8332-8c7f29b2a537

📥 Commits

Reviewing files that changed from the base of the PR and between e1fbdd7 and c0a8ff6.

📒 Files selected for processing (1)
  • pkg/cloudevents/server/grpc/authz/kube/sar.go

@skeeey

skeeey commented Mar 17, 2026

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Mar 17, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit e8cd33e into open-cluster-management-io:main Mar 17, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants