diff --git a/api/resmap/resmap.go b/api/resmap/resmap.go index 9ae9f0af1..b86b2f699 100644 --- a/api/resmap/resmap.go +++ b/api/resmap/resmap.go @@ -618,13 +618,19 @@ func (m *resWrangler) SubsetThatCouldBeReferencedByResource( // the outer most suffix and the last prefix. Use PrefixedSuffixesEquals instead. resId := r.CurId() if (!isInputIdNamespaceable || !resId.IsNamespaceableKind() || resId.IsNsEquals(inputId) || - subjectNamespaces[r.GetNamespace()]) && r.InSameKustomizeCtx(rctxm) { + isRoleBindingNamespace(&subjectNamespaces, r.GetNamespace())) && r.InSameKustomizeCtx(rctxm) { result.append(r) } } return result } +// isRoleBindingNamespace returns true is the namespace `ns` is in role binding +// namespaces `m` +func isRoleBindingNamespace(m *map[string]bool, ns string) bool { + return (*m)[ns] +} + // getNamespacesForRoleBinding returns referenced ServiceAccount namespaces if the inputRes is // a RoleBinding func getNamespacesForRoleBinding(inputRes *resource.Resource) map[string]bool {