Skip to content

Commit 54bed71

Browse files
authored
fix(api): ignore not found error while deleting finalizers (#936)
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
1 parent 146b606 commit 54bed71

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

images/virtualization-artifact/pkg/controller/reconciler/resource.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"maps"
2323
"reflect"
2424

25+
kerrors "k8s.io/apimachinery/pkg/api/errors"
2526
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2627
"k8s.io/apimachinery/pkg/types"
2728
"k8s.io/utils/strings/slices"
@@ -205,6 +206,10 @@ func (r *Resource[T, ST]) Update(ctx context.Context) error {
205206
}
206207
jsonPatch := client.RawPatch(types.JSONPatchType, metadataPatchBytes)
207208
if err = r.client.Patch(ctx, r.changedObj, jsonPatch); err != nil {
209+
if r.changedObj.GetDeletionTimestamp() != nil && len(r.changedObj.GetFinalizers()) == 0 && kerrors.IsNotFound(err) {
210+
return nil
211+
}
212+
208213
return fmt.Errorf("error patching metadata: %w", err)
209214
}
210215

tests/e2e/default_config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ logFilter:
4040
- "pattern to exclude"
4141
- "Server rejected event (will not retry!)" # Msg.
4242
- "validation failed for data source objectref" # Err.
43-
- "error patching metadata: virtualdisks" # Err.
44-
- "error patching metadata: virtualmachineclasses" # Err.
4543
- "clean up failed for data source registry" # Err.
4644
- "VDSnapshot object ref" # Err.
4745
- "VirtualDiskSnapshot " # Err.

0 commit comments

Comments
 (0)