Skip to content

Commit

Permalink
Improve docs, improve code clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
PBundyra committed Nov 29, 2024
1 parent c9058d9 commit 989dd48
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions apis/kueue/v1beta1/workload_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ type PodSetAssignment struct {
// cloud.provider.com/topology-rack: rack-2
//
// Example:
// Below there is an equivalent of the above example assuming, Topology
// object defines kubernetes.io/hostname as the lowest level in topology.
// Hence we omit higher level of topologies, since the hostname label
// is sufficient to explicitly identify a proper node.
//
// topologyAssignment:
// levels:
Expand Down
4 changes: 4 additions & 0 deletions keps/2724-topology-aware-scheduling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ type PodSetAssignment struct {
// cloud.provider.com/topology-rack: rack-2
//
// Example:
// Below there is an equivalent of the above example assuming, Topology
// object defines kubernetes.io/hostname as the lowest level in topology.
// Hence we omit higher level of topologies, since the hostname label
// is sufficient to explicitly identify a proper node.
//
// topologyAssignment:
// levels:
Expand Down
5 changes: 3 additions & 2 deletions pkg/cache/tas_flavor_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,12 @@ func (s *TASFlavorSnapshot) buildAssignment(domains []*domain) *kueue.TopologyAs
slices.SortFunc(domains, func(a, b *domain) int {
return cmp.Compare(a.id, b.id)
})
levelIdx := 0
// assign only hostname values if topology defines it
if s.isLowestLevelNode() {
return s.buildTopologyAssignmentForLevels(domains, len(s.levelKeys)-1)
levelIdx = len(s.levelKeys) - 1
}
return s.buildTopologyAssignmentForLevels(domains, 0)
return s.buildTopologyAssignmentForLevels(domains, levelIdx)
}

func (s *TASFlavorSnapshot) lowerLevelDomains(domains []*domain) []*domain {
Expand Down
6 changes: 5 additions & 1 deletion site/content/en/docs/reference/kueue.v1beta1.md
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,11 @@ cloud.provider.com/topology-rack: rack-1</li>
cloud.provider.com/topology-block: block-1
cloud.provider.com/topology-rack: rack-2</li>
</ul>
<p>Example:</p>
<p>Example:
Below there is an equivalent of the above example assuming, Topology
object defines kubernetes.io/hostname as the lowest level in topology.
Hence we omit higher level of topologies, since the hostname label
is sufficient to explicitly identify a proper node.</p>
<p>topologyAssignment:
levels:</p>
<ul>
Expand Down

0 comments on commit 989dd48

Please sign in to comment.