Skip to content

Commit

Permalink
getResourceGroupByResource recovered
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Shipkov <[email protected]>
  • Loading branch information
grem-li committed Nov 22, 2024
1 parent d25e062 commit f3236fc
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,7 @@ func getNodeForTieBreaker(
log.Trace(fmt.Sprintf("[getNodeForTieBreaker] resource %s does not use a node %s", resources[0].Name, node.Name))
}

RGName := rds[resources[0].Name].ResourceGroupName
rg := rgs[RGName]
rg := getResourceGroupByResource(resources[0].Name, rds, rgs)

if key, exist := rg.Props[replicasOnSameRGKey]; exist {
unusedNodes = filterNodesByReplicasOnSame(unusedNodes, key)
Expand Down Expand Up @@ -477,6 +476,10 @@ func filterNodesByReplicasOnSame(nodes []lapi.Node, key string) []lapi.Node {
return filtered
}

func getResourceGroupByResource(resourceName string, rds map[string]lapi.ResourceDefinitionWithVolumeDefinition, rgs map[string]lapi.ResourceGroup) lapi.ResourceGroup {
return rgs[rds[resourceName].ResourceGroupName]
}

func filterOutUsedNodes(nodes []lapi.Node, resources []lapi.Resource) []lapi.Node {
unusedNodes := make([]lapi.Node, 0, len(nodes))
resNodes := make(map[string]struct{}, len(resources))
Expand Down

0 comments on commit f3236fc

Please sign in to comment.