@@ -21,6 +21,7 @@ import (
21
21
clusterv1alpha2 "github.com/clusterpedia-io/api/cluster/v1alpha2"
22
22
kubestatemetrics "github.com/clusterpedia-io/clusterpedia/pkg/kube_state_metrics"
23
23
"github.com/clusterpedia-io/clusterpedia/pkg/storage"
24
+ "github.com/clusterpedia-io/clusterpedia/pkg/storage/memorystorage"
24
25
"github.com/clusterpedia-io/clusterpedia/pkg/synchromanager/clustersynchro/informer"
25
26
"github.com/clusterpedia-io/clusterpedia/pkg/synchromanager/clustersynchro/queue"
26
27
"github.com/clusterpedia-io/clusterpedia/pkg/synchromanager/features"
@@ -67,6 +68,8 @@ type ResourceSynchro struct {
67
68
68
69
// for debug
69
70
runningStage string
71
+
72
+ transDeleteObject bool
70
73
}
71
74
72
75
func newResourceSynchro (cluster string , syncResource schema.GroupVersionResource , kind string , lw cache.ListerWatcher , rvs map [string ]interface {},
@@ -95,6 +98,8 @@ func newResourceSynchro(cluster string, syncResource schema.GroupVersionResource
95
98
96
99
closer : make (chan struct {}),
97
100
closed : make (chan struct {}),
101
+
102
+ transDeleteObject : storage .GetStorageName () != memorystorage .StorageName ,
98
103
}
99
104
close (synchro .runnableForStorage )
100
105
synchro .ctx , synchro .cancel = context .WithCancel (context .Background ())
@@ -317,6 +322,12 @@ func (synchro *ResourceSynchro) OnDelete(obj interface{}) {
317
322
return
318
323
}
319
324
325
+ if ! synchro .transDeleteObject {
326
+ synchro .pruneObject (obj .(* unstructured.Unstructured ))
327
+ _ = synchro .queue .Delete (obj )
328
+ return
329
+ }
330
+
320
331
key , err := cache .DeletionHandlingMetaNamespaceKeyFunc (obj )
321
332
if err != nil {
322
333
return
0 commit comments