-
Notifications
You must be signed in to change notification settings - Fork 21
support sncloud rbac resources #332
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
Conversation
- Added RoleBinding controller to manage RoleBinding resources in Kubernetes. - Updated RoleBindingSpec to change fields from single string to array of strings for better flexibility. - Enhanced CRD definitions to reflect the new array types for SRN fields. - Introduced deep copy methods for RoleBindingList and ClusterRoleList to support list operations. - Added documentation for RoleBinding resource, including examples and specifications.
|
@freeznet:Thanks for your contribution. For this PR, do we need to update docs? |
|
the operator is |
We are planning to make this operator as StreamNative resources operator in future, and currently we already have multiple resources supported: StreamNativeCloudConnection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds initial support for StreamNative Cloud RBAC resources, including RoleBinding and ClusterRole.
- Implements a
RoleBindingClientwith CRUD and watch capabilities for cloud RoleBindings. - Generates informers, listers, and clientsets for
RoleBindingandClusterRole. - Extends the controller, CRDs, and documentation to handle the new RBAC resources.
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/streamnativecloud/rolebinding_client.go | Client methods for RoleBinding operations |
| controllers/rolebinding_controller.go | Reconciler logic for RoleBinding lifecycle |
| pkg/streamnativecloud/apis/cloud/v1alpha1/rolebinding_types.go | CRD type definitions for RoleBinding |
| config/crd/bases/resource.streamnative.io_rolebindings.yaml | CRD schema for RoleBinding |
| docs/rolebinding.md | User guide and examples for RoleBinding |
Comments suppressed due to low confidence (4)
controllers/rolebinding_controller.go:23
- [nitpick] Consider using a more descriptive import alias than
controllers2(e.g.,cloudclient) to clarify its purpose.
controllers2 "github.com/streamnative/pulsar-resources-operator/pkg/streamnativecloud"
pkg/streamnativecloud/rolebinding_client.go:79
- Add unit tests for
convertToCloudRoleBindingandmakeResourceNamesto verify correct transformation of localRoleBindingspecs into cloud API objects.
func convertToCloudRoleBinding(roleBinding *resourcev1alpha1.RoleBinding, organization string) *cloudapi.RoleBinding {
docs/rolebinding.md:57
- Update the type of
status.failedClustersto match the CRD ([]FailedClusterobjects withname,namespace, andreason), not plain strings.
| `status.failedClusters` | []string | A list of clusters where applying the role binding failed. |
docs/rolebinding.md:58
- Correct the type of
status.syncedClustersin the docs tomap[string]int64to align with the CRD'sobservedGenerationvalues.
| `status.syncedClusters` | map[string]string | A map of clusters where the role binding has been successfully synced. The key is the cluster name and the value is the sync status. |
| } | ||
|
|
||
| // makeResourceNames creates ResourceName array from SRN fields | ||
| func makeResourceNames(spec resourcev1alpha1.RoleBindingSpec, organization string) []cloudapi.ResourceName { |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The ResourceName type includes an APIKey field but it's never set here. Either populate it or remove the field to avoid confusion.
(If this PR fixes a github issue, please add
Fixes #<xyz>.)Fixes #
(or if this PR is one task of a github issue, please add
Master Issue: #<xyz>to link to the master issue.)Master Issue: #
Motivation
Explain here the context, and why you're making that change. What is the problem you're trying to solve.
Modifications
Describe the modifications you've done.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation
Check the box below.
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-doc(Please explain why)
doc(If this PR contains doc changes)