@@ -38,7 +38,6 @@ import (
3838 "k8s.io/utils/ptr"
3939 jobsetapi "sigs.k8s.io/jobset/api/jobset/v1alpha2"
4040
41- kueue "sigs.k8s.io/kueue/apis/kueue/v1beta1"
4241 "sigs.k8s.io/kueue/pkg/podset"
4342
4443 awv1beta2 "github.com/project-codeflare/appwrapper/api/v1beta2"
@@ -349,32 +348,28 @@ func EnsureComponentStatusInitialized(aw *awv1beta2.AppWrapper) error {
349348 return nil
350349}
351350
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 {}
355354 if err := EnsureComponentStatusInitialized (aw ); err != nil {
356- return nil , err
355+ return nil , nil , err
357356 }
358357 for idx := range aw .Status .ComponentStatus {
359358 if len (aw .Status .ComponentStatus [idx ].PodSets ) > 0 {
360359 obj := & unstructured.Unstructured {}
361360 if _ , _ , err := unstructured .UnstructuredJSONScheme .Decode (aw .Spec .Components [idx ].Template .Raw , nil , obj ); err != nil {
362361 // Should be unreachable; Template.Raw validated by AppWrapper AdmissionController
363- return nil , err
362+ return nil , nil , err
364363 }
365- for psIdx , podSet := range aw .Status .ComponentStatus [idx ].PodSets {
366- replicas := Replicas (podSet )
364+ for _ , podSet := range aw .Status .ComponentStatus [idx ].PodSets {
367365 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 )
373368 }
374369 }
375370 }
376371 }
377- return podSets , nil
372+ return templates , podSets , nil
378373}
379374
380375// SetPodSetInfos propagates podSetsInfo into the PodSetInfos of aw.Spec.Components
0 commit comments