File tree 1 file changed +10
-10
lines changed
pkg/synchromanager/clustersynchro
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -317,18 +317,18 @@ func (synchro *ResourceSynchro) OnDelete(obj interface{}) {
317
317
return
318
318
}
319
319
320
- key , err := cache .DeletionHandlingMetaNamespaceKeyFunc (obj )
321
- if err != nil {
322
- return
320
+ if d , ok := obj .(cache.DeletedFinalStateUnknown ); ok {
321
+ if obj , ok = d .Obj .(* unstructured.Unstructured ); ! ok {
322
+ namespace , name , err := cache .SplitMetaNamespaceKey (d .Key )
323
+ if err != nil {
324
+ return
325
+ }
326
+ obj = & metav1.PartialObjectMetadata {ObjectMeta : metav1.ObjectMeta {Namespace : namespace , Name : name }}
327
+ }
323
328
}
324
- namespace , name , err := cache .SplitMetaNamespaceKey (key )
325
- if err != nil {
326
- return
329
+ if o , ok := obj .(* unstructured.Unstructured ); ok {
330
+ synchro .pruneObject (o )
327
331
}
328
-
329
- // Since it is not necessary to save the complete deleted object to the queue,
330
- // we convert the object to `PartialObjectMetadata`
331
- obj = & metav1.PartialObjectMetadata {ObjectMeta : metav1.ObjectMeta {Namespace : namespace , Name : name }}
332
332
_ = synchro .queue .Delete (obj )
333
333
}
334
334
You can’t perform that action at this time.
0 commit comments