@@ -298,6 +298,18 @@ func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest)
298
298
// to add desired managed resources.
299
299
xr, err := request.GetObservedCompositeResource(req)
300
300
if err != nil {
301
+ // You can set a custom status condition on the claim. This
302
+ // allows you to communicate with the user.
303
+ response.ConditionFalse(rsp, "FunctionSuccess", "InternalError").
304
+ WithMessage("Something went wrong.").
305
+ TargetCompositeAndClaim()
306
+
307
+ // You can emit an event regarding the claim. This allows you to
308
+ // communicate with the user. Note that events should be used
309
+ // sparingly and are subject to throttling
310
+ response.Warning(rsp, errors.New("something went wrong")).
311
+ TargetCompositeAndClaim()
312
+
301
313
// If the function can't read the XR, the request is malformed. This
302
314
// should never happen. The function returns a fatal result. This tells
303
315
// Crossplane to stop running functions and return an error.
@@ -388,6 +400,11 @@ func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest)
388
400
// Kubernetes events associated with the XR it's operating on.
389
401
log.Info("Added desired buckets", "region", region, "count", len(names))
390
402
403
+ // You can set a custom status condition on the claim. This allows you
404
+ // to communicate with the user.
405
+ response.ConditionTrue(rsp, "FunctionSuccess", "Success").
406
+ TargetCompositeAndClaim()
407
+
391
408
return rsp, nil
392
409
}
393
410
` ` `
0 commit comments