@@ -20,6 +20,8 @@ package controllers
20
20
import (
21
21
"context"
22
22
23
+ "sigs.k8s.io/controller-runtime/pkg/client"
24
+
23
25
autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2"
24
26
25
27
"github.com/streamnative/function-mesh/api/compute/v1alpha1"
@@ -334,6 +336,10 @@ func (r *FunctionReconciler) ApplyFunctionVPA(ctx context.Context, function *v1a
334
336
}
335
337
336
338
func (r * FunctionReconciler ) ApplyFunctionCleanUpJob (ctx context.Context , function * v1alpha1.Function ) error {
339
+ backgroundDeletion := metav1 .DeletePropagationBackground
340
+ var deleteOptions client.DeleteOption = & client.DeleteOptions {
341
+ PropagationPolicy : & backgroundDeletion ,
342
+ }
337
343
if ! spec .NeedCleanup (function ) {
338
344
desiredJob := spec .MakeFunctionCleanUpJob (function )
339
345
if err := r .Delete (ctx , desiredJob ); err != nil {
@@ -380,7 +386,7 @@ func (r *FunctionReconciler) ApplyFunctionCleanUpJob(ctx context.Context, functi
380
386
}
381
387
} else {
382
388
// delete the cleanup job
383
- if err := r .Delete (ctx , desiredJob ); err != nil {
389
+ if err := r .Delete (ctx , desiredJob , deleteOptions ); err != nil {
384
390
return err
385
391
}
386
392
}
@@ -395,10 +401,9 @@ func (r *FunctionReconciler) ApplyFunctionCleanUpJob(ctx context.Context, functi
395
401
396
402
desiredJob := spec .MakeFunctionCleanUpJob (function )
397
403
// delete the cleanup job
398
- if err := r .Delete (ctx , desiredJob ); err != nil {
404
+ if err := r .Delete (ctx , desiredJob , deleteOptions ); err != nil {
399
405
return err
400
406
}
401
-
402
407
}
403
408
}
404
409
return nil
0 commit comments