Skip to content

Commit

Permalink
chore: update for empty domain tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdeal committed Jan 26, 2024
1 parent 08ed23a commit 1961fac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
type TopologyDomainGroup map[string][][]v1.Taint

func NewTopologyDomainGroup() TopologyDomainGroup {
return map[string][][]v1.Taint{}
return TopologyDomainGroup{}
}

// Insert either adds a new domain to the TopologyDomainGroup or updates an existing domain.
Expand Down
15 changes: 10 additions & 5 deletions pkg/controllers/provisioning/scheduling/topologygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,31 @@ func NewTopologyGroup(topologyType TopologyType, topologyKey string, pod *v1.Pod
nodeSelector = MakeTopologyNodeFilter(pod, nodeTaintsPolicy, nodeAffinityPolicy)
}

domainCounts := map[string]int32{}
domains := map[string]int32{}
if nodeSelector.TaintPolicy == v1.NodeInclusionPolicyHonor {
domainGroup.ForEachToleratedDomain(pod, func(domain string) {
domainCounts[domain] = 0
domains[domain] = 0
})
} else {
domainGroup.ForEachDomain(func(domain string) {
domainCounts[domain] = 0
domains[domain] = 0
})
}

emptyDomains := sets.New[string]()
for domain := range domains {
emptyDomains.Insert(domain)
}

return &TopologyGroup{
Type: topologyType,
Key: topologyKey,
namespaces: namespaces,
selector: labelSelector,
nodeFilter: nodeSelector,
maxSkew: maxSkew,
domains: domainCounts,
emptyDomains: domains.Clone(),
domains: domains,
emptyDomains: emptyDomains,
owners: map[types.UID]struct{}{},
minDomains: minDomains,
}
Expand Down

0 comments on commit 1961fac

Please sign in to comment.