File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -152,9 +152,22 @@ func (f *Function) handleApprovedChanges(req *fnv1.RunFunctionRequest, in *v1bet
152152 return err
153153 }
154154
155- // When approved, we just pass through the desired state from the request
156- // without any modifications - this preserves the exact output from previous functions
157- rsp .Desired = req .GetDesired ()
155+ // When approved, we need to carefully handle the resourceRefs field
156+ // Get the desired composite resource to update properties properly
157+ dxr , err := request .GetDesiredCompositeResource (req )
158+ if err != nil {
159+ response .Fatal (rsp , errors .Wrap (err , "cannot get desired composite resource" ))
160+ return err
161+ }
162+
163+ // Save the desired XR in the response
164+ if err := response .SetDesiredCompositeResource (rsp , dxr ); err != nil {
165+ response .Fatal (rsp , errors .Wrapf (err , "cannot set desired composite resource in %T" , rsp ))
166+ return err
167+ }
168+
169+ // For composed resources, we can pass through from the request
170+ rsp .Desired .Resources = req .GetDesired ().GetResources ()
158171
159172 // Set success condition
160173 response .ConditionTrue (rsp , "FunctionSuccess" , "Success" ).
You can’t perform that action at this time.
0 commit comments