@@ -62,10 +62,6 @@ func (w *AppWrapperWebhook) Default(ctx context.Context, obj runtime.Object) err
6262 if w .Config .EnableKueueIntegrations {
6363 jobframework .ApplyDefaultForSuspend ((* wlc .AppWrapper )(aw ), w .Config .ManageJobsWithoutQueueName )
6464 }
65- if err := expandPodSets (ctx , aw ); err != nil {
66- log .FromContext (ctx ).Info ("Error raised during podSet expansion" , "job" , aw )
67- return err
68- }
6965 return nil
7066}
7167
@@ -102,44 +98,6 @@ func (w *AppWrapperWebhook) ValidateDelete(context.Context, runtime.Object) (adm
10298 return nil , nil
10399}
104100
105- // expandPodSets expands and simplifies the AppWrapper's PodSets
106- func expandPodSets (_ context.Context , aw * workloadv1beta2.AppWrapper ) error {
107- components := aw .Spec .Components
108- componentsPath := field .NewPath ("spec" ).Child ("components" )
109- for idx , component := range components {
110- compPath := componentsPath .Index (idx )
111- podSetsPath := compPath .Child ("podSets" )
112-
113- // TODO: Here is where we would automatically create elided PodSets for known GVKs
114- // See https://github.com/project-codeflare/appwrapper/issues/65
115-
116- // Evaluate any ReplicaPaths and expand them to Replicas to simplify later processing
117- for psIdx , ps := range component .PodSets {
118- podSetPath := podSetsPath .Index (psIdx )
119- if ps .ReplicaPath != "" {
120- unstruct := & unstructured.Unstructured {}
121- _ , _ , err := unstructured .UnstructuredJSONScheme .Decode (component .Template .Raw , nil , unstruct )
122- if err != nil {
123- return field .Invalid (compPath .Child ("template" ), component .Template , "failed to decode as JSON" )
124- }
125-
126- if rc , err := utils .GetReplicas (unstruct , ps .ReplicaPath ); err != nil {
127- return field .Invalid (podSetPath .Child ("replicaPath" ), ps .ReplicaPath ,
128- fmt .Sprintf ("replicaPath does not refer to an int: %v" , err ))
129- } else {
130- if ps .Replicas != nil && * ps .Replicas != rc {
131- return field .Invalid (podSetPath .Child ("replicas" ), ps .Replicas ,
132- fmt .Sprintf ("does not match value %v at path %v" , rc , ps .ReplicaPath ))
133- }
134- component .PodSets [psIdx ].Replicas = & rc
135- }
136- }
137- }
138-
139- }
140- return nil
141- }
142-
143101// rbacs required to enable SubjectAccessReview
144102//+kubebuilder:rbac:groups=authorization.k8s.io,resources=subjectaccessreviews,verbs=create
145103//+kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=list
@@ -262,9 +220,6 @@ func (w *AppWrapperWebhook) validateAppWrapperUpdate(old *workloadv1beta2.AppWra
262220 if oldComponent .PodSets [psIdx ].PodPath != newComponent .PodSets [psIdx ].PodPath {
263221 allErrors = append (allErrors , field .Forbidden (compPath .Child ("podsets" ).Index (psIdx ).Child ("podPath" ), msg ))
264222 }
265- if oldComponent .PodSets [psIdx ].ReplicaPath != newComponent .PodSets [psIdx ].ReplicaPath {
266- allErrors = append (allErrors , field .Forbidden (compPath .Child ("podsets" ).Index (psIdx ).Child ("replciaPath" ), msg ))
267- }
268223 }
269224 }
270225 }
0 commit comments