Skip to content

Commit

Permalink
Fix: delete Job cascading delete Pod fail (#343)
Browse files Browse the repository at this point in the history
Co-authored-by: lisen <[email protected]>
  • Loading branch information
leason00 and lisen authored Aug 17, 2022
1 parent d9360c0 commit 34d5b1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ func deleteApplyJob(ctx context.Context, meta *TFConfigurationMeta, k8sClient cl
klog.InfoS("Deleting the apply job", "Name", meta.ApplyJobName)
for _, combination := range possibleCombination {
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &job); err == nil {
if err := k8sClient.Delete(ctx, &job); err != nil {
if err := k8sClient.Delete(ctx, &job, client.PropagationPolicy(metav1.DeletePropagationBackground)); err != nil {
return client.IgnoreNotFound(err)
}
}
Expand All @@ -1127,7 +1127,7 @@ func deleteDestroyJob(ctx context.Context, meta *TFConfigurationMeta, k8sClient
klog.InfoS("Deleting the destroy job", "Name", meta.DestroyJobName)
for _, combination := range possibleCombination {
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &job); err == nil {
if err := k8sClient.Delete(ctx, &job); err != nil {
if err := k8sClient.Delete(ctx, &job, client.PropagationPolicy(metav1.DeletePropagationBackground)); err != nil {
return client.IgnoreNotFound(err)
}
}
Expand Down

0 comments on commit 34d5b1b

Please sign in to comment.