Skip to content

Commit

Permalink
Merge pull request #342 from chivalryq/fix-destroy
Browse files Browse the repository at this point in the history
Fix: async delete cause duplicated destroy
  • Loading branch information
Somefive authored Aug 16, 2022
2 parents b224570 + 3a96f68 commit d9360c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ func deleteConfigMap(ctx context.Context, meta *TFConfigurationMeta, k8sClient c
for _, combination := range possibleCombination {
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &cm); err == nil {
if err := k8sClient.Delete(ctx, &cm); err != nil {
return err
return client.IgnoreNotFound(err)
}
}
}
Expand All @@ -1090,7 +1090,7 @@ func deleteVariableSecret(ctx context.Context, meta *TFConfigurationMeta, k8sCli
for _, combination := range possibleCombination {
if err := k8sClient.Get(ctx, client.ObjectKey{Name: combination[0], Namespace: combination[1]}, &variableSecret); err == nil {
if err := k8sClient.Delete(ctx, &variableSecret); err != nil {
return err
return client.IgnoreNotFound(err)
}
}
}
Expand All @@ -1109,7 +1109,7 @@ func deleteApplyJob(ctx context.Context, meta *TFConfigurationMeta, k8sClient cl
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 {
return err
return client.IgnoreNotFound(err)
}
}
}
Expand All @@ -1128,7 +1128,7 @@ func deleteDestroyJob(ctx context.Context, meta *TFConfigurationMeta, k8sClient
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 {
return err
return client.IgnoreNotFound(err)
}
}
}
Expand Down

0 comments on commit d9360c0

Please sign in to comment.