@@ -23,13 +23,10 @@ import (
2323 v1 "k8s.io/api/core/v1"
2424 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2525 "k8s.io/apimachinery/pkg/runtime"
26-
27- workloadv1beta2 "github.com/project-codeflare/appwrapper/api/v1beta2"
28- kueue "sigs.k8s.io/kueue/apis/kueue/v1beta1"
2926)
3027
31- // getPodTemplateSpec extracts a Kueue-compatible PodTemplateSpec at the given path within obj
32- func getPodTemplateSpec (obj * unstructured.Unstructured , path string ) (* v1.PodTemplateSpec , error ) {
28+ // GetPodTemplateSpec extracts a Kueue-compatible PodTemplateSpec at the given path within obj
29+ func GetPodTemplateSpec (obj * unstructured.Unstructured , path string ) (* v1.PodTemplateSpec , error ) {
3330 candidatePTS , err := getRawTemplate (obj .UnstructuredContent (), path )
3431 if err != nil {
3532 return nil , err
@@ -59,26 +56,6 @@ func getPodTemplateSpec(obj *unstructured.Unstructured, path string) (*v1.PodTem
5956 return template , nil
6057}
6158
62- func getKueuePodSets (obj * unstructured.Unstructured , component * workloadv1beta2.AppWrapperComponent , awName string , componentIdx int ) ([]kueue.PodSet , error ) {
63- podSets := []kueue.PodSet {}
64- for psIdx , podSet := range component .PodSets {
65- replicas := int32 (1 )
66- if podSet .Replicas != nil {
67- replicas = * podSet .Replicas
68- }
69- template , err := getPodTemplateSpec (obj , podSet .Path )
70- if err != nil {
71- return nil , err
72- }
73- podSets = append (podSets , kueue.PodSet {
74- Name : fmt .Sprintf ("%s-%v-%v" , awName , componentIdx , psIdx ),
75- Template : * template ,
76- Count : replicas ,
77- })
78- }
79- return podSets , nil
80- }
81-
8259// return the subobject found at the given path, or nil if the path is invalid
8360func getRawTemplate (obj map [string ]interface {}, path string ) (map [string ]interface {}, error ) {
8461 parts := strings .Split (path , "." )
0 commit comments