@@ -45,14 +45,14 @@ while allowing users to specify required constraints for strict placement (upper
4545├─────────────────────────────────────────────────────────────────────────┤
4646│ │
4747│ Admin Layer: │
48- │ ┌──────────────────────┐ ┌──────────────────────┐ │
49- │ │ ClusterTopology │ │ Kueue Topology │ │
50- │ │ "grove-topology" │ │ "grove-topology" │ │
51- │ │ │ │ (manual creation) │ │
52- │ └──────────┬───────────┘ └───────────┬──────────┘ │
48+ │ ┌──────────────────────┐ ┌──────────────────────┐ │
49+ │ │ ClusterTopology │ │ Kueue Topology │ │
50+ │ │ "grove-topology" │ │ "grove-topology" │ │
51+ │ │ │ │ (manual creation) │ │
52+ │ └──────────┬───────────┘ └──────────- ─┬─────────┘ │
5353│ │ │ │
5454│ │ │ │
55- │ Operator Config: topology.enabled=true │
55+ │ Operator Config: topology.enabled=true | |
5656│ │ │ │
5757│ │ (validates against) │ (referenced by) │
5858├─────────────┼───────────────────────────────────┼───────────────────────┤
@@ -109,55 +109,55 @@ narrowest scope.
109109** API Structure:**
110110
111111``` go
112- // TopologyDomain represents a predefined topology level in the hierarchy
112+ // TopologyDomain represents a predefined topology level in the hierarchy.
113113type TopologyDomain string
114114
115115const (
116- TopologyDomainRegion TopologyDomain = " region"
117- TopologyDomainZone TopologyDomain = " zone"
118- TopologyDomainDataCenter TopologyDomain = " datacenter"
119- TopologyDomainBlock TopologyDomain = " block"
120- TopologyDomainRack TopologyDomain = " rack"
121- TopologyDomainHost TopologyDomain = " host"
122- TopologyDomainNuma TopologyDomain = " numa"
116+ TopologyDomainRegion TopologyDomain = " region"
117+ TopologyDomainZone TopologyDomain = " zone"
118+ TopologyDomainDataCenter TopologyDomain = " datacenter"
119+ TopologyDomainBlock TopologyDomain = " block"
120+ TopologyDomainRack TopologyDomain = " rack"
121+ TopologyDomainHost TopologyDomain = " host"
122+ TopologyDomainNuma TopologyDomain = " numa"
123123)
124124
125125// Topology ordering (broadest to narrowest):
126126// Region > Zone > DataCenter > Block > Rack > Host > Numa
127127
128- // ClusterTopology defines the topology hierarchy for the cluster
129- // This resource is immutable after creation
128+ // ClusterTopology defines the topology hierarchy for the cluster.
129+ // This resource is immutable after creation.
130130type ClusterTopology struct {
131- metav1.TypeMeta ` json:",inline"`
132- metav1.ObjectMeta ` json:"metadata,omitempty"`
131+ metav1.TypeMeta ` json:",inline"`
132+ metav1.ObjectMeta ` json:"metadata,omitempty"`
133133
134- Spec ClusterTopologySpec ` json:"spec,omitempty"`
134+ Spec ClusterTopologySpec ` json:"spec,omitempty"`
135135}
136136
137137type ClusterTopologySpec struct {
138- // Levels is an ordered list of topology levels from broadest to narrowest scope
139- // The order in this list defines the hierarchy (index 0 = highest level)
140- // This field is immutable after creation
141- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="levels list is immutable"
142- // +kubebuilder:validation:MinItems=1
143- // +kubebuilder:validation:MaxItems=8
144- Levels []TopologyLevel ` json:"levels"`
138+ // Levels is an ordered list of topology levels from broadest to narrowest scope.
139+ // The order in this list defines the hierarchy (index 0 = highest level).
140+ // This field is immutable after creation.
141+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="levels list is immutable"
142+ // +kubebuilder:validation:MinItems=1
143+ // +kubebuilder:validation:MaxItems=8
144+ Levels []TopologyLevel ` json:"levels"`
145145}
146146
147147type TopologyLevel struct {
148- // Domain is the predefined level identifier used in TopologyConstraint references
149- // Must be one of: region, zone, datacenter, block, rack, host, numa
150- // +kubebuilder:validation:Required
151- // +kubebuilder:validation:Enum=region;zone;datacenter;block;rack;host;numa
152- Domain TopologyDomain ` json:"domain"`
153-
154- // Key is the node label key that identifies this topology domain
155- // Must be a valid Kubernetes label key (qualified name)
156- // Examples: "topology.kubernetes.io/zone", "kubernetes.io/hostname"
157- // +kubebuilder:validation:Required
158- // +kubebuilder:validation:MinLength=1
159- // +kubebuilder:validation:MaxLength=64
160- Key string ` json:"key"`
148+ // Domain is the predefined level identifier used in TopologyConstraint references.
149+ // Must be one of: region, zone, datacenter, block, rack, host, numa.
150+ // +kubebuilder:validation:Required
151+ // +kubebuilder:validation:Enum=region;zone;datacenter;block;rack;host;numa
152+ Domain TopologyDomain ` json:"domain"`
153+
154+ // Key is the node label key that identifies this topology domain.
155+ // Must be a valid Kubernetes label key (qualified name).
156+ // Examples: "topology.kubernetes.io/zone", "kubernetes.io/hostname".
157+ // +kubebuilder:validation:Required
158+ // +kubebuilder:validation:MinLength=1
159+ // +kubebuilder:validation:MaxLength=64
160+ Key string ` json:"key"`
161161}
162162```
163163
@@ -315,14 +315,14 @@ topology:
315315
316316` ` ` go
317317type TopologyConstraint struct {
318- // PackDomain specifies the topology level name for grouping replicas
319- // Controls placement constraint for EACH individual replica instance
320- // Must be one of: region, zone, datacenter, block, rack, host, numa
321- // Example: "rack" means each replica independently placed within one rack
322- // Note: Does NOT constrain all replicas to the same rack together
323- // Different replicas can be in different topology domains
324- // +kubebuilder:validation:Enum=region;zone;datacenter;block;rack;host;numa
325- PackDomain *TopologyDomain ` json:"packDomain,omitempty"`
318+ // PackDomain specifies the topology level name for grouping replicas
319+ // Controls placement constraint for EACH individual replica instance
320+ // Must be one of: region, zone, datacenter, block, rack, host, numa
321+ // Example: "rack" means each replica independently placed within one rack
322+ // Note: Does NOT constrain all replicas to the same rack together
323+ // Different replicas can be in different topology domains
324+ // +kubebuilder:validation:Enum=region;zone;datacenter;block;rack;host;numa
325+ PackDomain *TopologyDomain ` json:"packDomain,omitempty"`
326326}
327327```
328328
@@ -345,37 +345,37 @@ PackDomain *TopologyDomain `json:"packDomain,omitempty"`
345345
346346``` go
347347type PodCliqueSetTemplateSpec struct {
348- // ... existing fields ...
348+ // ... existing fields ...
349349
350- // TopologyConstraint defines topology placement requirements for PodCliqueSet
351- // +optional
352- TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
350+ // TopologyConstraint defines topology placement requirements for PodCliqueSet.
351+ // +optional
352+ TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
353353}
354354```
355355
356356#### PodCliqueScalingGroup CRD Extensions
357357
358358``` go
359359type PodCliqueScalingGroupConfig struct {
360- // ... existing fields ...
360+ // ... existing fields ...
361361
362- // TopologyConstraint defines topology placement requirements for PodCliqueScalingGroup
363- // Must be equal to or stricter than parent PodCliqueSet constraints
364- // +optional
365- TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
362+ // TopologyConstraint defines topology placement requirements for PodCliqueScalingGroup.
363+ // Must be equal to or stricter than parent PodCliqueSet constraints.
364+ // +optional
365+ TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
366366}
367367```
368368
369369#### PodClique CRD Extensions
370370
371371``` go
372372type PodCliqueTemplateSpec struct {
373- // ... existing fields ...
373+ // ... existing fields ...
374374
375- // TopologyConstraint defines topology placement requirements for PodClique
376- // Must be equal to or stricter than parent resource constraints
377- // +optional
378- TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
375+ // TopologyConstraint defines topology placement requirements for PodClique.
376+ // Must be equal to or stricter than parent resource constraints.
377+ // +optional
378+ TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
379379}
380380```
381381
@@ -422,35 +422,35 @@ KAI scheduler.
422422
423423``` go
424424type PodGangSpec struct {
425- // PodGroups is a list of member pod groups in the PodGang
426- PodGroups []PodGroup ` json:"podgroups"`
427-
428- // TopologyConstraint defines topology packing constraints for entire pod gang
429- // Translated from PodCliqueSet.TopologyConstraint
430- // Updated by operator on each reconciliation when PodCliqueSet topology constraints change
431- // +optional
432- TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
433-
434- // TopologyConstraintGroupConfigs defines groups of PodGroups for topology-aware placement
435- // Enhanced with topology constraints for PodCliqueScalingGroup (PCSG) level packing
436- // Updated by operator on each reconciliation when PCSG topology constraints change
437- // +optional
438- TopologyConstraintGroupConfigs []TopologyConstraintGroupConfig ` json:"topologyConstraintGroupConfigs,omitempty"`
439-
440- // PriorityClassName is the name of the PriorityClass for the PodGang
441- PriorityClassName string ` json:"priorityClassName,omitempty"`
425+ // PodGroups is a list of member pod groups in the PodGang
426+ PodGroups []PodGroup ` json:"podgroups"`
427+
428+ // TopologyConstraint defines topology packing constraints for entire pod gang
429+ // Translated from PodCliqueSet.TopologyConstraint
430+ // Updated by operator on each reconciliation when PodCliqueSet topology constraints change
431+ // +optional
432+ TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
433+
434+ // TopologyConstraintGroupConfigs defines groups of PodGroups for topology-aware placement
435+ // Enhanced with topology constraints for PodCliqueScalingGroup (PCSG) level packing
436+ // Updated by operator on each reconciliation when PCSG topology constraints change
437+ // +optional
438+ TopologyConstraintGroupConfigs []TopologyConstraintGroupConfig ` json:"topologyConstraintGroupConfigs,omitempty"`
439+
440+ // PriorityClassName is the name of the PriorityClass for the PodGang
441+ PriorityClassName string ` json:"priorityClassName,omitempty"`
442442}
443443```
444444
445445** PodGang Metadata:**
446446
447447The operator adds topology information to PodGang metadata via annotation:
448448
449- ``` go
450- // Annotation added to PodGang
449+ ``` yaml
450+ # Annotation added to PodGang
451451metadata :
452- annotations:
453- grove.io /topology-name: " <user-configured-name>"
452+ annotations :
453+ grove.io/topology-name : " <user-configured-name>"
454454` ` `
455455
456456This annotation allows the scheduler to locate the Kueue Topology resource without requiring a spec field, providing
@@ -459,63 +459,63 @@ flexibility for future API changes.
459459**TopologyConstraintGroupConfig:**
460460
461461` ` ` go
462- // TopologyConstraintGroupConfig defines topology constraints for a group of PodGroups
462+ // TopologyConstraintGroupConfig defines topology constraints for a group of PodGroups.
463463type TopologyConstraintGroupConfig struct {
464- // PodGroupNames is the list of PodGroup names in the topology constraint group
465- PodGroupNames []string ` json:"podGroupNames"`
466-
467- // TopologyConstraint defines topology packing constraints for this group
468- // Enables PCSG-level topology constraints
469- // Updated by operator when PodCliqueScalingGroup topology constraints change
470- // +optional
471- TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
464+ // PodGroupNames is the list of PodGroup names in the topology constraint group.
465+ PodGroupNames []string `json:"podGroupNames"`
466+
467+ // TopologyConstraint defines topology packing constraints for this group.
468+ // Enables PCSG-level topology constraints.
469+ // Updated by operator when PodCliqueScalingGroup topology constraints change.
470+ // +optional
471+ TopologyConstraint *TopologyConstraint `json:"topologyConstraint,omitempty"`
472472}
473473```
474474
475475** PodGroup:**
476476
477477``` go
478478type PodGroup struct {
479- // Name is the name of the PodGroup
480- Name string ` json:"name"`
479+ // Name is the name of the PodGroup
480+ Name string ` json:"name"`
481481
482- // PodReferences is a list of references to the Pods in this group
483- PodReferences []NamespacedName ` json:"podReferences"`
482+ // PodReferences is a list of references to the Pods in this group
483+ PodReferences []NamespacedName ` json:"podReferences"`
484484
485- // MinReplicas is the number of replicas that needs to be gang scheduled
486- MinReplicas int32 ` json:"minReplicas"`
485+ // MinReplicas is the number of replicas that needs to be gang scheduled
486+ MinReplicas int32 ` json:"minReplicas"`
487487
488- // TopologyConstraint defines topology packing constraints for this PodGroup
489- // Enables PodClique-level topology constraints
490- // Updated by operator when PodClique topology constraints change
491- // +optional
492- TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
488+ // TopologyConstraint defines topology packing constraints for this PodGroup
489+ // Enables PodClique-level topology constraints
490+ // Updated by operator when PodClique topology constraints change
491+ // +optional
492+ TopologyConstraint *TopologyConstraint ` json:"topologyConstraint,omitempty"`
493493}
494494```
495495
496496** Supporting Types:**
497497
498498``` go
499499type TopologyConstraint struct {
500- // PackConstraint defines topology packing constraint with required and preferred levels
501- // Operator translates user's level name to corresponding keys
502- // +optional
503- PackConstraint *TopologyPackConstraint ` json:"packConstraint,omitempty"`
500+ // PackConstraint defines topology packing constraint with required and preferred levels.
501+ // Operator translates user's level name to corresponding keys.
502+ // +optional
503+ PackConstraint *TopologyPackConstraint ` json:"packConstraint,omitempty"`
504504}
505505
506506type TopologyPackConstraint struct {
507- // Required defines topology constraint that must be satisfied
508- // Holds key (not level name) translated from user's packDomain specification
509- // Example: "topology.kubernetes.io/rack"
510- // +optional
511- Required *string ` json:"required,omitempty"`
512-
513- // Preferred defines best-effort topology constraint
514- // Auto-generated by operator using strictest level key for optimization
515- // Scheduler can fallback to less strict levels if preferred cannot be satisfied
516- // Example: "kubernetes.io/hostname"
517- // +optional
518- Preferred *string ` json:"preferred,omitempty"`
507+ // Required defines topology constraint that must be satisfied.
508+ // Holds key (not level name) translated from user's packDomain specification.
509+ // Example: "topology.kubernetes.io/rack".
510+ // +optional
511+ Required *string ` json:"required,omitempty"`
512+
513+ // Preferred defines best-effort topology constraint.
514+ // Auto-generated by operator using strictest level key for optimization.
515+ // Scheduler can fallback to less strict levels if preferred cannot be satisfied.
516+ // Example: "kubernetes.io/hostname".
517+ // +optional
518+ Preferred *string ` json:"preferred,omitempty"`
519519}
520520```
521521
@@ -591,7 +591,7 @@ User creates PodCliqueSet with 3 replicas:
591591
592592``` yaml
593593spec :
594- replicas : 3
594+ replicas : 3
595595 template :
596596 topologyConstraint :
597597 packDomain : " rack" # User specifies level NAME (per-replica constraint)
@@ -631,7 +631,7 @@ Grove operator requires read access to ClusterTopology and permission to manage
631631
632632` ` ` yaml
633633rules :
634- - apiGroups : [ "grove.io" ]
635- resources : [ "clustertopologies", "clustertopologies/finalizers" ]
634+ - apiGroups : [ "grove.io" ]
635+ resources : [ "clustertopologies", "clustertopologies/finalizers" ]
636636 verbs : [ "get", "list", "watch", "update" ]
637637` ` `
0 commit comments