bugfix: Fix the permission issue that rbgs controller cannot create rbg #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The rgbs controller needs to create/delete rbg objects according to the rgbs declaration. Currently, the controller lacks the create/delete permission for rgb. The specific error is as follows
{"level":"ERROR","time":"2025-09-02T01:12:47.892Z","caller":"workloads/rolebasedgroupset_controller.go:97","message":"create rbg failed.","controller":"workloads-rolebasedgroupset","controllerGroup":"workloads.x-k8s.io","controllerKind":"RoleBasedGroupSet","RoleBasedGroupSet":{"name":"rbgs-test","namespace":"default"},"namespace":"default","name":"rbgs-test","reconcileID":"7fbf093e-4a74-494e-a182-0f1efef5ffb7","rbgset":{"name":"rbgs-test","namespace":"default"},"error":"create rbg error: rolebasedgroups.workloads.x-k8s.io is forbidden: User \"system:serviceaccount:rbgs-system:rbgs-rbgs-controller-sa\" cannot create resource \"rolebasedgroups\" in API group \"workloads.x-k8s.io\" in the namespace \"default\"","stacktrace":"sigs.k8s.io/rbgs/internal/controller/workloads.(*RoleBasedGroupSetReconciler).Reconcile.func1\n\t/workspace/internal/controller/workloads/rolebasedgroupset_controller.go:97"}Reproduction method:
make deployto deploy rbg.kubectl apply -f examples/rbgs/rbgs-base.yamlto deploy the test case.kubectl logs -n rbgs-system <controller-pod>to view the error log.make undeployto clean up the test resources.