Skip to content

Commit 7dbce58

Browse files
committed
Remove duplicated xr handling
Signed-off-by: Yury Tsarev <yury@upbound.io>
1 parent 126fdc3 commit 7dbce58

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

fn.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -152,35 +152,6 @@ func (f *Function) handleApprovedChanges(req *fnv1.RunFunctionRequest, in *v1bet
152152
return err
153153
}
154154

155-
// For approved changes, we need to properly pass through the entire desired state
156-
// from the previous function, including both the XR and composed resources
157-
158-
// Get the desired composite resource
159-
dxr, err := request.GetDesiredCompositeResource(req)
160-
if err != nil {
161-
response.Fatal(rsp, errors.Wrap(err, "cannot get desired composite resource"))
162-
return err
163-
}
164-
165-
// Set the desired composite resource in the response
166-
if err := response.SetDesiredCompositeResource(rsp, dxr); err != nil {
167-
response.Fatal(rsp, errors.Wrapf(err, "cannot set desired composite resource in %T", rsp))
168-
return err
169-
}
170-
171-
// Get the desired composed resources using the SDK
172-
desired, err := request.GetDesiredComposedResources(req)
173-
if err != nil {
174-
response.Fatal(rsp, errors.Wrapf(err, "cannot get desired resources from %T", req))
175-
return err
176-
}
177-
178-
// Set the desired composed resources in the response
179-
if err := response.SetDesiredComposedResources(rsp, desired); err != nil {
180-
response.Fatal(rsp, errors.Wrapf(err, "cannot set desired composed resources in %T", rsp))
181-
return err
182-
}
183-
184155
// Set success condition
185156
response.ConditionTrue(rsp, "FunctionSuccess", "Success").
186157
WithMessage("Approved successfully").
@@ -651,9 +622,6 @@ func (f *Function) overwriteDesiredWithObserved(req *fnv1.RunFunctionRequest, rs
651622
return nil
652623
}
653624

654-
// These functions were previously used to overwrite the composite resource
655-
// Now we only handle composed resources, so they are removed to avoid confusion
656-
657625
// overwriteComposedResources overwrites desired composed resources with observed ones
658626
func (f *Function) overwriteComposedResources(req *fnv1.RunFunctionRequest, rsp *fnv1.RunFunctionResponse) error {
659627
// Only process if there are desired resources to overwrite

0 commit comments

Comments
 (0)