🐛 Add addon v1beta1 to supported type for grpc - #216
Conversation
Signed-off-by: Jian Qiu <jqiu@redhat.com>
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughThis 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment 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. |
There was a problem hiding this comment.
🧹 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
toSubjectAccessReviewtests to assert thatv1beta1.ManagedClusterAddOnEventDataTyperesolves to the expectedResourceAttributes(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
📒 Files selected for processing (1)
pkg/cloudevents/server/grpc/authz/kube/sar.go
|
/lgtm |
e8cd33e
into
open-cluster-management-io:main
Summary
Related issue(s)
Fixes #
Summary by CodeRabbit