Skip to content

Commit b66fb33

Browse files
authored
fix: checking namespace when fetching roles/rolebindings for the service account (#67)
1 parent c008bab commit b66fb33

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

controllers/namespacescope_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ func (r *NamespaceScopeReconciler) GetRolesFromServiceAccount(sa string, namespa
495495
var roleNameList []string
496496
for _, roleBinding := range roleBindings.Items {
497497
for _, subject := range roleBinding.Subjects {
498-
if subject.Name == sa && subject.Kind == "ServiceAccount" {
498+
if subject.Name == sa && subject.Kind == "ServiceAccount" && subject.Namespace == namespace {
499499
roleNameList = append(roleNameList, roleBinding.RoleRef.Name)
500500
}
501501
}

0 commit comments

Comments
 (0)