Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #24665: Number of nodes in rule badge is not correct with tenants #5572

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,15 @@ object RuleTarget extends Loggable {
// here, if we don't find the group, we consider it's an error in the
// target recording, but don't fail, just log it.
case GroupTarget(groupId) =>
nodes ++ groups.getOrElse(groupId, Chunk.empty)
val groupNodes = groups.getOrElse(groupId, Chunk.empty)
val filtered = {
if (allNodesAreThere) groupNodes
else {
val keys = Chunk.fromIterable(allNodes.keys)
groupNodes.filter(keys.contains(_))
}
}
nodes ++ filtered

case TargetIntersection(targets) =>
val nodeSets = targets.map(t => getNodeIdsChunkRec(Chunk(t), allNodes, groups, allNodesAreThere))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ object RoNodeGroupRepository {
allNodeInfos: Map[NodeId, NodeInfo]
): Chunk[NodeId] = {
val allNodes = allNodeInfos.view.mapValues(x => (x.isPolicyServer))
RuleTarget.getNodeIdsChunk(targets, allNodes.toMap, allGroups)
RuleTarget.getNodeIdsChunk(targets, allNodes.toMap, allGroups, false)
}
}

Expand Down