Skip to content

Commit 3a96f68

Browse files
committed
Fix: async delete cause duplicated destroy
Signed-off-by: Qiaozp <[email protected]>
1 parent b224570 commit 3a96f68

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

controllers/configuration_controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ func deleteConfigMap(ctx context.Context, meta *TFConfigurationMeta, k8sClient c
10711071
for _, combination := range possibleCombination {
10721072
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &cm); err == nil {
10731073
if err := k8sClient.Delete(ctx, &cm); err != nil {
1074-
return err
1074+
return client.IgnoreNotFound(err)
10751075
}
10761076
}
10771077
}
@@ -1090,7 +1090,7 @@ func deleteVariableSecret(ctx context.Context, meta *TFConfigurationMeta, k8sCli
10901090
for _, combination := range possibleCombination {
10911091
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &variableSecret); err == nil {
10921092
if err := k8sClient.Delete(ctx, &variableSecret); err != nil {
1093-
return err
1093+
return client.IgnoreNotFound(err)
10941094
}
10951095
}
10961096
}
@@ -1109,7 +1109,7 @@ func deleteApplyJob(ctx context.Context, meta *TFConfigurationMeta, k8sClient cl
11091109
for _, combination := range possibleCombination {
11101110
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &job); err == nil {
11111111
if err := k8sClient.Delete(ctx, &job); err != nil {
1112-
return err
1112+
return client.IgnoreNotFound(err)
11131113
}
11141114
}
11151115
}
@@ -1128,7 +1128,7 @@ func deleteDestroyJob(ctx context.Context, meta *TFConfigurationMeta, k8sClient
11281128
for _, combination := range possibleCombination {
11291129
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &job); err == nil {
11301130
if err := k8sClient.Delete(ctx, &job); err != nil {
1131-
return err
1131+
return client.IgnoreNotFound(err)
11321132
}
11331133
}
11341134
}

0 commit comments

Comments
 (0)