diff --git a/pkg/agent/controller/managedclusterrolebinding_controller.go b/pkg/agent/controller/managedclusterrolebinding_controller.go index dcd2e899..f119048f 100644 --- a/pkg/agent/controller/managedclusterrolebinding_controller.go +++ b/pkg/agent/controller/managedclusterrolebinding_controller.go @@ -205,7 +205,7 @@ func (r *ManagedClusterRoleBindingReconciler) SetupWithManager(mgr ctrl.Manager) } func getSubject(managedCRB authzv1alpah1.ManagedClusterRoleBinding) []rbac.Subject { - var subs []rbac.Subject + subs := make([]rbac.Subject, 0, len(managedCRB.Subjects)) for _, sub := range managedCRB.Subjects { subs = append(subs, rbac.Subject{ APIGroup: sub.APIGroup,