fix: sa binds rbac role (#2187)

* fix: sa binds rbac role

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>

* fix ut test

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>

* make goimports

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>

---------

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>
Co-authored-by: wenhaozhou <wenhaozhou@yunify.com>
Signed-off-by: hongming <coder.scala@gmail.com>
This commit is contained in:
KubeSphere CI Bot
2025-01-13 16:25:26 +08:00
committed by hongming
parent 834c393cf0
commit 8286d4888e
2 changed files with 28 additions and 7 deletions

View File

@@ -37,6 +37,7 @@ var _ = Describe("ServiceAccount", func() {
saName = "test-serviceaccount"
saNamespace = "default"
saRole = "test-role"
refRole = "kubesphere:iam:test-role"
)
var role *rbacv1.Role
var sa *corev1.ServiceAccount
@@ -45,8 +46,11 @@ var _ = Describe("ServiceAccount", func() {
BeforeEach(func() {
role = &rbacv1.Role{
ObjectMeta: metav1.ObjectMeta{
Name: saRole,
Name: refRole,
Namespace: saNamespace,
Labels: map[string]string{
iamv1beta1.RoleReferenceLabel: saRole,
},
},
}