@@ -38,7 +38,6 @@ import (
38
38
"k8s.io/utils/ptr"
39
39
jobsetapi "sigs.k8s.io/jobset/api/jobset/v1alpha2"
40
40
41
- kueue "sigs.k8s.io/kueue/apis/kueue/v1beta1"
42
41
"sigs.k8s.io/kueue/pkg/podset"
43
42
44
43
awv1beta2 "github.com/project-codeflare/appwrapper/api/v1beta2"
@@ -349,32 +348,28 @@ func EnsureComponentStatusInitialized(aw *awv1beta2.AppWrapper) error {
349
348
return nil
350
349
}
351
350
352
- // GetPodSets constructs the kueue.PodSets for an AppWrapper
353
- func GetPodSets ( aw * awv1beta2. AppWrapper ) ([]kueue. PodSet , error ) {
354
- podSets := []kueue. PodSet {}
351
+ func GetComponentPodSpecs ( aw * awv1beta2. AppWrapper ) ([] * v1. PodTemplateSpec , []awv1beta2. AppWrapperPodSet , error ) {
352
+ templates := [] * v1. PodTemplateSpec {}
353
+ podSets := []awv1beta2. AppWrapperPodSet {}
355
354
if err := EnsureComponentStatusInitialized (aw ); err != nil {
356
- return nil , err
355
+ return nil , nil , err
357
356
}
358
357
for idx := range aw .Status .ComponentStatus {
359
358
if len (aw .Status .ComponentStatus [idx ].PodSets ) > 0 {
360
359
obj := & unstructured.Unstructured {}
361
360
if _ , _ , err := unstructured .UnstructuredJSONScheme .Decode (aw .Spec .Components [idx ].Template .Raw , nil , obj ); err != nil {
362
361
// Should be unreachable; Template.Raw validated by AppWrapper AdmissionController
363
- return nil , err
362
+ return nil , nil , err
364
363
}
365
- for psIdx , podSet := range aw .Status .ComponentStatus [idx ].PodSets {
366
- replicas := Replicas (podSet )
364
+ for _ , podSet := range aw .Status .ComponentStatus [idx ].PodSets {
367
365
if template , err := GetPodTemplateSpec (obj , podSet .Path ); err == nil {
368
- podSets = append (podSets , kueue.PodSet {
369
- Name : fmt .Sprintf ("%s-%v-%v" , aw .Name , idx , psIdx ),
370
- Template : * template ,
371
- Count : replicas ,
372
- })
366
+ templates = append (templates , template )
367
+ podSets = append (podSets , podSet )
373
368
}
374
369
}
375
370
}
376
371
}
377
- return podSets , nil
372
+ return templates , podSets , nil
378
373
}
379
374
380
375
// SetPodSetInfos propagates podSetsInfo into the PodSetInfos of aw.Spec.Components
0 commit comments