mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +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.
|
// the outer most suffix and the last prefix. Use PrefixedSuffixesEquals instead.
|
||||||
resId := r.CurId()
|
resId := r.CurId()
|
||||||
if (!isInputIdNamespaceable || !resId.IsNamespaceableKind() || resId.IsNsEquals(inputId) ||
|
if (!isInputIdNamespaceable || !resId.IsNamespaceableKind() || resId.IsNsEquals(inputId) ||
|
||||||
subjectNamespaces[r.GetNamespace()]) && r.InSameKustomizeCtx(rctxm) {
|
isRoleBindingNamespace(&subjectNamespaces, r.GetNamespace())) && r.InSameKustomizeCtx(rctxm) {
|
||||||
result.append(r)
|
result.append(r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
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
|
// getNamespacesForRoleBinding returns referenced ServiceAccount namespaces if the inputRes is
|
||||||
// a RoleBinding
|
// a RoleBinding
|
||||||
func getNamespacesForRoleBinding(inputRes *resource.Resource) map[string]bool {
|
func getNamespacesForRoleBinding(inputRes *resource.Resource) map[string]bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user