mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 18:10:59 +00:00
Add function to check role binding namespace
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user