Repository: kubernetes-sigs/kube-scheduler-simulator
Pull request #408 (2025-02-21 02:08:08)

cleanup: make oneshotimporter use resourceapplier
<!--  Thanks for sending a pull request!  Here are some tips for you:

1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide/first-contribution.md#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request. For reference on required PR/issue labels, read here:
https://git.k8s.io/community/contributors/devel/sig-release/release.md#issuepr-kind-label
3. Ensure you have added or ran the appropriate tests for your PR: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
4. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
5. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

#### What type of PR is this?

/area simulator
/kind cleanup

<!--
Add related area tag(s):
/area web
/area simulator
/area scenario

Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature

Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:

#400 modularized the codes of applying resources as resourceapplier. The PR made only syncer to use it.

This PR does the same for oneshotimporter. Also, it enables to specify the GVRs to import.

#### Which issue(s) this PR fixes:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

#### Special notes for your reviewer:


/label tide/merge-method-squash


k8s-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/408#" title="Author self-approved">saza-ku</a>*
**Once this PR has been reviewed and has the lgtm label**, please assign [196ikuchil](https://github.com/196ikuchil) for approval. For more information see [the Code Review Process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process).

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fkube-scheduler-simulator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/kubernetes-sigs/kube-scheduler-simulator/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["196ikuchil"]} -->
k8s-ci-robot: Hi @saza-ku. Thanks for your PR.

I'm waiting for a [kubernetes-sigs](https://github.com/orgs/kubernetes-sigs/people) member to verify that this patch is reasonable to test. If it is, they should reply with `/ok-to-test` on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should [join the org](https://git.k8s.io/community/community-membership.md#member) to skip this step.

Once the patch is verified, the new status will be reflected by the `ok-to-test` label.

I understand the commands that are listed [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fkube-scheduler-simulator).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>

k8s-ci-robot: @sanposhiho: GitHub didn't allow me to request PR reviews from the following users: ordovicia.

Note that only [kubernetes-sigs members](https://github.com/orgs/kubernetes-sigs/people) and repo collaborators can review this PR, and authors cannot review their own PRs.

<details>

In response to [this](https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/408#pullrequestreview-2631881198):

>/ok-to-test
>/cc @ordovicia @utam0k 


Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>
k8s-ci-robot: @saza-ku: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-kube-scheduler-simulator-backend-lint | 43aff67fbf2b4a4767a9b6184deae793544492c8 | [link](https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_kube-scheduler-simulator/408/pull-kube-scheduler-simulator-backend-lint/1892786203711770624) | true | `/test pull-kube-scheduler-simulator-backend-lint`

[Full PR test history](https://prow.k8s.io/pr-history?org=kubernetes-sigs&repo=kube-scheduler-simulator&pr=408). [Your PR dashboard](https://prow.k8s.io/pr?query=is%3Apr%20state%3Aopen%20author%3Asaza-ku). Please help us cut down on flakes by [linking to](https://git.k8s.io/community/contributors/devel/sig-testing/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/kubernetes-sigs/kube-scheduler-simulator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
k8s-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/408#pullrequestreview-2631926358" title="Approved">ordovicia</a>*, *<a href="https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/408#" title="Author self-approved">saza-ku</a>*
**Once this PR has been reviewed and has the lgtm label**, please assign [196ikuchil](https://github.com/196ikuchil) for approval. For more information see [the Code Review Process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process).

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fkube-scheduler-simulator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/kubernetes-sigs/kube-scheduler-simulator/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["196ikuchil"]} -->
k8s-ci-robot: PR needs rebase.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>
saza-ku: @utam0k and @ordovicia have reviewed this PR. Please review it :pray:
k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/408#pullrequestreview-2631926358" title="Approved">ordovicia</a>*, *<a href="https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/408#pullrequestreview-2680771121" title="Approved">sanposhiho</a>*, *<a href="https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/408#" title="Author self-approved">saza-ku</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fkube-scheduler-simulator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/kube-scheduler-simulator/blob/master/OWNERS)~~ [sanposhiho]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/simulator/cmd/simulator/simulator.go b/simulator/cmd/simulator/simulator.go
index 0cb46ac1..da656ec4 100644
--- a/simulator/cmd/simulator/simulator.go
+++ b/simulator/cmd/simulator/simulator.go
@@ -56,14 +56,8 @@ func startSimulator() error {
 	cachedDiscoveryClient := memory.NewMemCacheClient(discoverClient)
 	restMapper := restmapper.NewDeferredDiscoveryRESTMapper(cachedDiscoveryClient)
 
-	importClusterResourceClient := &clientset.Clientset{}
 	var importClusterDynamicClient dynamic.Interface
 	if cfg.ExternalImportEnabled || cfg.ResourceSyncEnabled {
-		importClusterResourceClient, err = clientset.NewForConfig(cfg.ExternalKubeClientCfg)
-		if err != nil {
-			return xerrors.Errorf("creates a new Clientset for the ExternalKubeClientCfg: %w", err)
-		}
-
 		importClusterDynamicClient, err = dynamic.NewForConfig(cfg.ExternalKubeClientCfg)
 		if err != nil {
 			return xerrors.Errorf("creates a new dynamic Clientset for the ExternalKubeClientCfg: %w", err)
@@ -94,7 +88,7 @@ func startSimulator() error {
 		return xerrors.Errorf("kubeapi-server is not ready: %w", err)
 	}
 
-	dic, err := di.NewDIContainer(client, dynamicClient, restMapper, etcdclient, restCfg, cfg.InitialSchedulerCfg, cfg.ExternalImportEnabled, cfg.ResourceSyncEnabled, importClusterResourceClient, importClusterDynamicClient, cfg.Port, resourceapplier.Options{})
+	dic, err := di.NewDIContainer(client, dynamicClient, restMapper, etcdclient, restCfg, cfg.InitialSchedulerCfg, cfg.ExternalImportEnabled, cfg.ResourceSyncEnabled, importClusterDynamicClient, cfg.Port, resourceapplier.Options{})
 	if err != nil {
 		return xerrors.Errorf("create di container: %w", err)
 	}
diff --git a/simulator/oneshotimporter/importer.go b/simulator/oneshotimporter/importer.go
index a0dd3af2..89b458ca 100644
--- a/simulator/oneshotimporter/importer.go
+++ b/simulator/oneshotimporter/importer.go
@@ -4,35 +4,51 @@ package oneshotimporter
 
 import (
 	"context"
+	"fmt"
+	"sync"
 
 	"golang.org/x/xerrors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+	"k8s.io/apimachinery/pkg/runtime/schema"
+	"k8s.io/client-go/dynamic"
+	"k8s.io/klog/v2"
 
-	"sigs.k8s.io/kube-scheduler-simulator/simulator/snapshot"
+	"sigs.k8s.io/kube-scheduler-simulator/simulator/resourceapplier"
 )
 
 // Service has two ReplicateServices.
 // importService is used to import(replicate) these resources to the simulator.
 // exportService is used to export resources from a target cluster.
 type Service struct {
-	importService ReplicateService
-	exportService ReplicateService
+	srcDynamicClient      dynamic.Interface
+	resouceApplierService *resourceapplier.Service
+	gvrs                  []schema.GroupVersionResource
 }
 
-type ReplicateService interface {
-	// Snap will be used to export resources from target cluster.
-	Snap(ctx context.Context, labelSelector metav1.LabelSelector, opts ...snapshot.Option) (*snapshot.ResourcesForSnap, error)
-	// Load will be used to import resources the from data which was exported.
-	Load(ctx context.Context, resources *snapshot.ResourcesForLoad, opts ...snapshot.Option) error
-	IgnoreErr() snapshot.Option
-	IgnoreSchedulerConfiguration() snapshot.Option
+// DefaultGVRs is a list of GroupVersionResource that we import.
+// Note that this order matters - When first importing resources, we want to import namespaces first, then priorityclasses, storageclasses...
+var DefaultGVRs = []schema.GroupVersionResource{
+	{Group: "", Version: "v1", Resource: "namespaces"},
+	{Group: "scheduling.k8s.io", Version: "v1", Resource: "priorityclasses"},
+	{Group: "storage.k8s.io", Version: "v1", Resource: "storageclasses"},
+	{Group: "", Version: "v1", Resource: "persistentvolumeclaims"},
+	{Group: "", Version: "v1", Resource: "nodes"},
+	{Group: "", Version: "v1", Resource: "persistentvolumes"},
+	{Group: "", Version: "v1", Resource: "pods"},
 }
 
 // NewService initializes Service.
-func NewService(e ReplicateService, i ReplicateService) *Service {
+func NewService(srcClient dynamic.Interface, resourceApplier *resourceapplier.Service) *Service {
+	gvrs := DefaultGVRs
+	if resourceApplier.GVRsToSync != nil {
+		gvrs = resourceApplier.GVRsToSync
+	}
+
 	return &Service{
-		importService: e,
-		exportService: i,
+		srcDynamicClient:      srcClient,
+		resouceApplierService: resourceApplier,
+		gvrs:                  gvrs,
 	}
 }
 
@@ -42,17 +58,40 @@ func NewService(e ReplicateService, i ReplicateService) *Service {
 // If you want to use the scheduler configuration along with the imported resources on the simulator,
 // you need to set the path of the scheduler configuration file to `kubeSchedulerConfigPath` value in the Simulator Server Configuration.
 func (s *Service) ImportClusterResources(ctx context.Context, labelSelector metav1.LabelSelector) error {
-	expRes, err := s.exportService.Snap(ctx, labelSelector)
+	for _, gvr := range s.gvrs {
+		if err := s.importResource(ctx, gvr, labelSelector); err != nil {
+			return xerrors.Errorf("import resource %s: %w", gvr.String(), err)
+		}
+	}
+
+	return nil
+}
+
+func (s *Service) importResource(ctx context.Context, gvr schema.GroupVersionResource, labelSelector metav1.LabelSelector) error {
+	selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
 	if err != nil {
-		return xerrors.Errorf("call Snap of the exportService: %w", err)
+		return xerrors.Errorf("convert label selector: %w", err)
 	}
-	impRes, err := snapshot.ConvertResourcesForSnapToResourcesForLoad(expRes)
+
+	resources, err := s.srcDynamicClient.Resource(gvr).List(ctx, metav1.ListOptions{
+		LabelSelector: selector.String(),
+	})
 	if err != nil {
-		return xerrors.Errorf("call ConvertResourcesForSnapToResourcesForLoad: %w", err)
+		return xerrors.Errorf("list resources: %w", err)
 	}
-	// Import to the simulator.
-	if err := s.importService.Load(ctx, impRes, s.importService.IgnoreErr(), s.importService.IgnoreSchedulerConfiguration()); err != nil {
-		return xerrors.Errorf("call Import of the importService: %w", err)
+
+	var wg sync.WaitGroup
+	for _, resource := range resources.Items {
+		wg.Add(1)
+		fmt.Printf("importing resource: %s\n", resource.GetName())
+		go func(r *unstructured.Unstructured) {
+			defer wg.Done()
+			if err := s.resouceApplierService.Create(ctx, r); err != nil {
+				klog.Warningf("failed to import resource: %v", err)
+			}
+		}(&resource)
 	}
+	wg.Wait()
+
 	return nil
 }
diff --git a/simulator/oneshotimporter/mock_clusterresourceimporter/replicate.go b/simulator/oneshotimporter/mock_clusterresourceimporter/replicate.go
deleted file mode 100644
index 506efe16..00000000
--- a/simulator/oneshotimporter/mock_clusterresourceimporter/replicate.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Code generated by MockGen. DO NOT EDIT.
-// Source: sigs.k8s.io/kube-scheduler-simulator/simulator/clusterresourceimporter (interfaces: ReplicateService)
-//
-// Generated by this command:
-//
-//	mockgen -destination=./mock_clusterresourceimporter/replicate.go . ReplicateService
-//
-
-// Package mock_clusterresourceimporter is a generated GoMock package.
-package mock_clusterresourceimporter
-
-import (
-	context "context"
-	reflect "reflect"
-
-	gomock "go.uber.org/mock/gomock"
-	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-
-	snapshot "sigs.k8s.io/kube-scheduler-simulator/simulator/snapshot"
-)
-
-// MockReplicateService is a mock of ReplicateService interface.
-type MockReplicateService struct {
-	ctrl     *gomock.Controller
-	recorder *MockReplicateServiceMockRecorder
-	isgomock struct{}
-}
-
-// MockReplicateServiceMockRecorder is the mock recorder for MockReplicateService.
-type MockReplicateServiceMockRecorder struct {
-	mock *MockReplicateService
-}
-
-// NewMockReplicateService creates a new mock instance.
-func NewMockReplicateService(ctrl *gomock.Controller) *MockReplicateService {
-	mock := &MockReplicateService{ctrl: ctrl}
-	mock.recorder = &MockReplicateServiceMockRecorder{mock}
-	return mock
-}
-
-// EXPECT returns an object that allows the caller to indicate expected use.
-func (m *MockReplicateService) EXPECT() *MockReplicateServiceMockRecorder {
-	return m.recorder
-}
-
-// IgnoreErr mocks base method.
-func (m *MockReplicateService) IgnoreErr() snapshot.Option {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "IgnoreErr")
-	ret0, _ := ret[0].(snapshot.Option)
-	return ret0
-}
-
-// IgnoreErr indicates an expected call of IgnoreErr.
-func (mr *MockReplicateServiceMockRecorder) IgnoreErr() *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IgnoreErr", reflect.TypeOf((*MockReplicateService)(nil).IgnoreErr))
-}
-
-// IgnoreSchedulerConfiguration mocks base method.
-func (m *MockReplicateService) IgnoreSchedulerConfiguration() snapshot.Option {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "IgnoreSchedulerConfiguration")
-	ret0, _ := ret[0].(snapshot.Option)
-	return ret0
-}
-
-// IgnoreSchedulerConfiguration indicates an expected call of IgnoreSchedulerConfiguration.
-func (mr *MockReplicateServiceMockRecorder) IgnoreSchedulerConfiguration() *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IgnoreSchedulerConfiguration", reflect.TypeOf((*MockReplicateService)(nil).IgnoreSchedulerConfiguration))
-}
-
-// Load mocks base method.
-func (m *MockReplicateService) Load(ctx context.Context, resources *snapshot.ResourcesForLoad, opts ...snapshot.Option) error {
-	m.ctrl.T.Helper()
-	varargs := []any{ctx, resources}
-	for _, a := range opts {
-		varargs = append(varargs, a)
-	}
-	ret := m.ctrl.Call(m, "Load", varargs...)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// Load indicates an expected call of Load.
-func (mr *MockReplicateServiceMockRecorder) Load(ctx, resources any, opts ...any) *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	varargs := append([]any{ctx, resources}, opts...)
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Load", reflect.TypeOf((*MockReplicateService)(nil).Load), varargs...)
-}
-
-// Snap mocks base method.
-func (m *MockReplicateService) Snap(arg0 context.Context, arg1 v1.LabelSelector, arg2 ...snapshot.Option) (*snapshot.ResourcesForSnap, error) {
-	m.ctrl.T.Helper()
-	varargs := []interface{}{arg0, arg1}
-	for _, a := range arg2 {
-		varargs = append(varargs, a)
-	}
-	ret := m.ctrl.Call(m, "Snap", varargs...)
-	ret0, _ := ret[0].(*snapshot.ResourcesForSnap)
-	ret1, _ := ret[1].(error)
-	return ret0, ret1
-}
-
-// Snap indicates an expected call of Snap.
-func (mr *MockReplicateServiceMockRecorder) Snap(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	varargs := append([]interface{}{arg0, arg1}, arg2...)
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Snap", reflect.TypeOf((*MockReplicateService)(nil).Snap), varargs...)
-}
diff --git a/simulator/oneshotimporter/mock_oneshotimporter/replicate.go b/simulator/oneshotimporter/mock_oneshotimporter/replicate.go
deleted file mode 100644
index 3f76a196..00000000
--- a/simulator/oneshotimporter/mock_oneshotimporter/replicate.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Code generated by MockGen. DO NOT EDIT.
-// Source: sigs.k8s.io/kube-scheduler-simulator/simulator/oneshotimporter (interfaces: ReplicateService)
-//
-// Generated by this command:
-//
-//	mockgen -destination=./mock_oneshotimporter/replicate.go . ReplicateService
-//
-
-// Package mock_oneshotimporter is a generated GoMock package.
-package mock_oneshotimporter
-
-import (
-	context "context"
-	reflect "reflect"
-
-	gomock "go.uber.org/mock/gomock"
-	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-
-	snapshot "sigs.k8s.io/kube-scheduler-simulator/simulator/snapshot"
-)
-
-// MockReplicateService is a mock of ReplicateService interface.
-type MockReplicateService struct {
-	ctrl     *gomock.Controller
-	recorder *MockReplicateServiceMockRecorder
-	isgomock struct{}
-}
-
-// MockReplicateServiceMockRecorder is the mock recorder for MockReplicateService.
-type MockReplicateServiceMockRecorder struct {
-	mock *MockReplicateService
-}
-
-// NewMockReplicateService creates a new mock instance.
-func NewMockReplicateService(ctrl *gomock.Controller) *MockReplicateService {
-	mock := &MockReplicateService{ctrl: ctrl}
-	mock.recorder = &MockReplicateServiceMockRecorder{mock}
-	return mock
-}
-
-// EXPECT returns an object that allows the caller to indicate expected use.
-func (m *MockReplicateService) EXPECT() *MockReplicateServiceMockRecorder {
-	return m.recorder
-}
-
-// IgnoreErr mocks base method.
-func (m *MockReplicateService) IgnoreErr() snapshot.Option {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "IgnoreErr")
-	ret0, _ := ret[0].(snapshot.Option)
-	return ret0
-}
-
-// IgnoreErr indicates an expected call of IgnoreErr.
-func (mr *MockReplicateServiceMockRecorder) IgnoreErr() *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IgnoreErr", reflect.TypeOf((*MockReplicateService)(nil).IgnoreErr))
-}
-
-// IgnoreSchedulerConfiguration mocks base method.
-func (m *MockReplicateService) IgnoreSchedulerConfiguration() snapshot.Option {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "IgnoreSchedulerConfiguration")
-	ret0, _ := ret[0].(snapshot.Option)
-	return ret0
-}
-
-// IgnoreSchedulerConfiguration indicates an expected call of IgnoreSchedulerConfiguration.
-func (mr *MockReplicateServiceMockRecorder) IgnoreSchedulerConfiguration() *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IgnoreSchedulerConfiguration", reflect.TypeOf((*MockReplicateService)(nil).IgnoreSchedulerConfiguration))
-}
-
-// Load mocks base method.
-func (m *MockReplicateService) Load(ctx context.Context, resources *snapshot.ResourcesForLoad, opts ...snapshot.Option) error {
-	m.ctrl.T.Helper()
-	varargs := []any{ctx, resources}
-	for _, a := range opts {
-		varargs = append(varargs, a)
-	}
-	ret := m.ctrl.Call(m, "Load", varargs...)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// Load indicates an expected call of Load.
-func (mr *MockReplicateServiceMockRecorder) Load(ctx, resources any, opts ...any) *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	varargs := append([]any{ctx, resources}, opts...)
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Load", reflect.TypeOf((*MockReplicateService)(nil).Load), varargs...)
-}
-
-// Snap mocks base method.
-func (m *MockReplicateService) Snap(ctx context.Context, labelSelector v1.LabelSelector, opts ...snapshot.Option) (*snapshot.ResourcesForSnap, error) {
-	m.ctrl.T.Helper()
-	varargs := []any{ctx, labelSelector}
-	for _, a := range opts {
-		varargs = append(varargs, a)
-	}
-	ret := m.ctrl.Call(m, "Snap", varargs...)
-	ret0, _ := ret[0].(*snapshot.ResourcesForSnap)
-	ret1, _ := ret[1].(error)
-	return ret0, ret1
-}
-
-// Snap indicates an expected call of Snap.
-func (mr *MockReplicateServiceMockRecorder) Snap(ctx, labelSelector any, opts ...any) *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	varargs := append([]any{ctx, labelSelector}, opts...)
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Snap", reflect.TypeOf((*MockReplicateService)(nil).Snap), varargs...)
-}
diff --git a/simulator/server/di/di.go b/simulator/server/di/di.go
index e46ebfd4..74a2cc95 100644
--- a/simulator/server/di/di.go
+++ b/simulator/server/di/di.go
@@ -43,7 +43,6 @@ func NewDIContainer(
 	initialSchedulerCfg *configv1.KubeSchedulerConfiguration,
 	externalImportEnabled bool,
 	resourceSyncEnabled bool,
-	externalClient clientset.Interface,
 	externalDynamicClient dynamic.Interface,
 	simulatorPort int,
 	resourceapplierOptions resourceapplier.Options,
@@ -59,11 +58,10 @@ func NewDIContainer(
 	}
 	snapshotSvc := snapshot.NewService(client, c.schedulerService)
 	c.snapshotService = snapshotSvc
+	resourceApplierService := resourceapplier.New(dynamicClient, restMapper, resourceapplierOptions)
 	if externalImportEnabled {
-		extSnapshotSvc := snapshot.NewService(externalClient, c.schedulerService)
-		c.oneshotClusterResourceImporter = oneshotimporter.NewService(snapshotSvc, extSnapshotSvc)
+		c.oneshotClusterResourceImporter = oneshotimporter.NewService(externalDynamicClient, resourceApplierService)
 	}
-	resourceApplierService := resourceapplier.New(dynamicClient, restMapper, resourceapplierOptions)
 	if resourceSyncEnabled {
 		c.resourceSyncer = syncer.New(externalDynamicClient, resourceApplierService)
 	}
diff --git a/simulator/server/di/interface.go b/simulator/server/di/interface.go
index 00150362..3d549894 100644
--- a/simulator/server/di/interface.go
+++ b/simulator/server/di/interface.go
@@ -25,7 +25,7 @@ type SchedulerService interface {
 
 // SnapshotService represents a service for exporting/importing resources on the simulator.
 type SnapshotService interface {
-	Snap(ctx context.Context, labelSelector metav1.LabelSelector, opts ...snapshot.Option) (*snapshot.ResourcesForSnap, error)
+	Snap(ctx context.Context, opts ...snapshot.Option) (*snapshot.ResourcesForSnap, error)
 	Load(ctx context.Context, resources *snapshot.ResourcesForLoad, opts ...snapshot.Option) error
 	IgnoreErr() snapshot.Option
 }
diff --git a/simulator/server/handler/snapshot.go b/simulator/server/handler/snapshot.go
index 9d57457a..5141d224 100644
--- a/simulator/server/handler/snapshot.go
+++ b/simulator/server/handler/snapshot.go
@@ -4,7 +4,6 @@ import (
 	"net/http"
 
 	"github.com/labstack/echo/v4"
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	v1 "k8s.io/client-go/applyconfigurations/core/v1"
 	schedulingcfgv1 "k8s.io/client-go/applyconfigurations/scheduling/v1"
 	confstoragev1 "k8s.io/client-go/applyconfigurations/storage/v1"
@@ -37,8 +36,7 @@ func NewSnapshotHandler(s di.SnapshotService) *SnapshotHandler {
 func (h *SnapshotHandler) Snap(c echo.Context) error {
 	ctx := c.Request().Context()
 
-	var label metav1.LabelSelector
-	rs, err := h.service.Snap(ctx, label)
+	rs, err := h.service.Snap(ctx)
 	if err != nil {
 		klog.Errorf("failed to save all resources: %+v", err)
 		return echo.NewHTTPError(http.StatusInternalServerError)
diff --git a/simulator/snapshot/snapshot.go b/simulator/snapshot/snapshot.go
index d2b597e1..ce2f6fb6 100644
--- a/simulator/snapshot/snapshot.go
+++ b/simulator/snapshot/snapshot.go
@@ -5,7 +5,6 @@ package snapshot
 import (
 	"context"
 	"errors"
-	"fmt"
 	"strings"
 
 	"golang.org/x/xerrors"
@@ -101,32 +100,29 @@ func (s *Service) IgnoreSchedulerConfiguration() Option {
 }
 
 // get gets all resources from each service.
-func (s *Service) get(ctx context.Context, labelSelector metav1.LabelSelector, opts options) (*ResourcesForSnap, error) {
+func (s *Service) get(ctx context.Context, opts options) (*ResourcesForSnap, error) {
 	errgrp := util.NewErrGroupWithSemaphore(ctx)
 	resources := ResourcesForSnap{}
 
-	fmt.Println("test")
-	fmt.Printf("%+v\n", labelSelector)
-
-	if err := s.listPods(ctx, &resources, errgrp, labelSelector, opts); err != nil {
+	if err := s.listPods(ctx, &resources, errgrp, opts); err != nil {
 		return nil, xerrors.Errorf("call listPods: %w", err)
 	}
-	if err := s.listNodes(ctx, &resources, errgrp, labelSelector, opts); err != nil {
+	if err := s.listNodes(ctx, &resources, errgrp, opts); err != nil {
 		return nil, xerrors.Errorf("call listNodes: %w", err)
 	}
-	if err := s.listPvs(ctx, &resources, errgrp, labelSelector, opts); err != nil {
+	if err := s.listPvs(ctx, &resources, errgrp, opts); err != nil {
 		return nil, xerrors.Errorf("call listPvs: %w", err)
 	}
-	if err := s.listPvcs(ctx, &resources, errgrp, labelSelector, opts); err != nil {
+	if err := s.listPvcs(ctx, &resources, errgrp, opts); err != nil {
 		return nil, xerrors.Errorf("call listPvcs: %w", err)
 	}
-	if err := s.listStorageClasses(ctx, &resources, errgrp, labelSelector, opts); err != nil {
+	if err := s.listStorageClasses(ctx, &resources, errgrp, opts); err != nil {
 		return nil, xerrors.Errorf("call listStorageClasses: %w", err)
 	}
-	if err := s.listPcs(ctx, &resources, errgrp, labelSelector, opts); err != nil {
+	if err := s.listPcs(ctx, &resources, errgrp, opts); err != nil {
 		return nil, xerrors.Errorf("call listPcs: %w", err)
 	}
-	if err := s.listNamespaces(ctx, &resources, errgrp, labelSelector, opts); err != nil {
+	if err := s.listNamespaces(ctx, &resources, errgrp, opts); err != nil {
 		return nil, xerrors.Errorf("call listNamespaces: %w", err)
 	}
 	if err := s.getSchedulerConfig(&resources, errgrp, opts); err != nil {
@@ -140,12 +136,12 @@ func (s *Service) get(ctx context.Context, labelSelector metav1.LabelSelector, o
 }
 
 // Snap exports all resources as one data.
-func (s *Service) Snap(ctx context.Context, labelSelector metav1.LabelSelector, opts ...Option) (*ResourcesForSnap, error) {
+func (s *Service) Snap(ctx context.Context, opts ...Option) (*ResourcesForSnap, error) {
 	options := options{}
 	for _, o := range opts {
 		o.apply(&options)
 	}
-	resources, err := s.get(ctx, labelSelector, options)
+	resources, err := s.get(ctx, options)
 	if err != nil {
 		return nil, xerrors.Errorf("failed to get(): %w", err)
 	}
@@ -218,15 +214,9 @@ func (s *Service) Load(ctx context.Context, resources *ResourcesForLoad, opts ..
 	return nil
 }
 
-func (s *Service) listPods(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, labelSelector metav1.LabelSelector, opts options) error {
+func (s *Service) listPods(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, opts options) error {
 	if err := eg.Go(func() error {
-		selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
-		if err != nil {
-			return xerrors.Errorf("failed to create label selector: %w", err)
-		}
-		pods, err := s.client.CoreV1().Pods(metav1.NamespaceAll).List(ctx, metav1.ListOptions{
-			LabelSelector: selector.String(),
-		})
+		pods, err := s.client.CoreV1().Pods(metav1.NamespaceAll).List(ctx, metav1.ListOptions{})
 		if err != nil {
 			if !opts.ignoreErr {
 				return xerrors.Errorf("call list Pod: %w", err)
@@ -242,15 +232,9 @@ func (s *Service) listPods(ctx context.Context, r *ResourcesForSnap, eg *util.Se
 	return nil
 }
 
-func (s *Service) listNodes(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, labelSelector metav1.LabelSelector, opts options) error {
+func (s *Service) listNodes(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, opts options) error {
 	if err := eg.Go(func() error {
-		selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
-		if err != nil {
-			return xerrors.Errorf("failed to create label selector: %w", err)
-		}
-		nodes, err := s.client.CoreV1().Nodes().List(ctx, metav1.ListOptions{
-			LabelSelector: selector.String(),
-		})
+		nodes, err := s.client.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
 		if err != nil {
 			if !opts.ignoreErr {
 				return xerrors.Errorf("call list Node: %w", err)
@@ -266,15 +250,9 @@ func (s *Service) listNodes(ctx context.Context, r *ResourcesForSnap, eg *util.S
 	return nil
 }
 
-func (s *Service) listPvs(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, labelSelector metav1.LabelSelector, opts options) error {
+func (s *Service) listPvs(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, opts options) error {
 	if err := eg.Go(func() error {
-		selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
-		if err != nil {
-			return xerrors.Errorf("failed to create label selector: %w", err)
-		}
-		pvs, err := s.client.CoreV1().PersistentVolumes().List(ctx, metav1.ListOptions{
-			LabelSelector: selector.String(),
-		})
+		pvs, err := s.client.CoreV1().PersistentVolumes().List(ctx, metav1.ListOptions{})
 		if err != nil {
 			if !opts.ignoreErr {
 				return xerrors.Errorf("call list PersistentVolume: %w", err)
@@ -290,15 +268,9 @@ func (s *Service) listPvs(ctx context.Context, r *ResourcesForSnap, eg *util.Sem
 	return nil
 }
 
-func (s *Service) listPvcs(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, labelSelector metav1.LabelSelector, opts options) error {
+func (s *Service) listPvcs(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, opts options) error {
 	if err := eg.Go(func() error {
-		selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
-		if err != nil {
-			return xerrors.Errorf("failed to create label selector: %w", err)
-		}
-		pvcs, err := s.client.CoreV1().PersistentVolumeClaims(metav1.NamespaceAll).List(ctx, metav1.ListOptions{
-			LabelSelector: selector.String(),
-		})
+		pvcs, err := s.client.CoreV1().PersistentVolumeClaims(metav1.NamespaceAll).List(ctx, metav1.ListOptions{})
 		if err != nil {
 			if !opts.ignoreErr {
 				return xerrors.Errorf("call list PersistentVolumeClaim: %w", err)
@@ -314,15 +286,9 @@ func (s *Service) listPvcs(ctx context.Context, r *ResourcesForSnap, eg *util.Se
 	return nil
 }
 
-func (s *Service) listStorageClasses(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, labelSelector metav1.LabelSelector, opts options) error {
+func (s *Service) listStorageClasses(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, opts options) error {
 	if err := eg.Go(func() error {
-		selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
-		if err != nil {
-			return xerrors.Errorf("failed to create label selector: %w", err)
-		}
-		scs, err := s.client.StorageV1().StorageClasses().List(ctx, metav1.ListOptions{
-			LabelSelector: selector.String(),
-		})
+		scs, err := s.client.StorageV1().StorageClasses().List(ctx, metav1.ListOptions{})
 		if err != nil {
 			if !opts.ignoreErr {
 				return xerrors.Errorf("call list StorageClass: %w", err)
@@ -338,15 +304,9 @@ func (s *Service) listStorageClasses(ctx context.Context, r *ResourcesForSnap, e
 	return nil
 }
 
-func (s *Service) listPcs(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, labelSelector metav1.LabelSelector, opts options) error {
+func (s *Service) listPcs(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, opts options) error {
 	if err := eg.Go(func() error {
-		selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
-		if err != nil {
-			return xerrors.Errorf("failed to create label selector: %w", err)
-		}
-		pcs, err := s.client.SchedulingV1().PriorityClasses().List(ctx, metav1.ListOptions{
-			LabelSelector: selector.String(),
-		})
+		pcs, err := s.client.SchedulingV1().PriorityClasses().List(ctx, metav1.ListOptions{})
 		if err != nil {
 			if !opts.ignoreErr {
 				return xerrors.Errorf("call list PriorityClass: %w", err)
@@ -368,15 +328,9 @@ func (s *Service) listPcs(ctx context.Context, r *ResourcesForSnap, eg *util.Sem
 	return nil
 }
 
-func (s *Service) listNamespaces(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, labelSelector metav1.LabelSelector, opts options) error {
+func (s *Service) listNamespaces(ctx context.Context, r *ResourcesForSnap, eg *util.SemaphoredErrGroup, opts options) error {
 	if err := eg.Go(func() error {
-		selector, err := metav1.LabelSelectorAsSelector(&labelSelector)
-		if err != nil {
-			return xerrors.Errorf("failed to create label selector: %w", err)
-		}
-		nss, err := s.client.CoreV1().Namespaces().List(ctx, metav1.ListOptions{
-			LabelSelector: selector.String(),
-		})
+		nss, err := s.client.CoreV1().Namespaces().List(ctx, metav1.ListOptions{})
 		if err != nil {
 			if !opts.ignoreErr {
 				return xerrors.Errorf("call list Namespace: %w", err)


Test patch:
diff --git a/simulator/oneshotimporter/importer_test.go b/simulator/oneshotimporter/importer_test.go
index 6b603e01..0675fdcc 100644
--- a/simulator/oneshotimporter/importer_test.go
+++ b/simulator/oneshotimporter/importer_test.go
@@ -4,69 +4,170 @@ import (
 	"context"
 	"testing"
 
-	"go.uber.org/mock/gomock"
-	"golang.org/x/xerrors"
+	"github.com/stretchr/testify/assert"
+	v1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+	"k8s.io/apimachinery/pkg/runtime"
+	"k8s.io/apimachinery/pkg/runtime/schema"
+	"k8s.io/client-go/dynamic/fake"
+	"k8s.io/client-go/restmapper"
+	scheduling "k8s.io/kubernetes/pkg/apis/scheduling/v1"
+	storage "k8s.io/kubernetes/pkg/apis/storage/v1"
 
-	m "sigs.k8s.io/kube-scheduler-simulator/simulator/oneshotimporter/mock_clusterresourceimporter"
-	"sigs.k8s.io/kube-scheduler-simulator/simulator/snapshot"
+	"sigs.k8s.io/kube-scheduler-simulator/simulator/resourceapplier"
 )
 
 func TestService_ImportClusterResources(t *testing.T) {
 	t.Parallel()
+
 	tests := []struct {
-		name                     string
-		prepareEachServiceMockFn func(*m.MockReplicateService, *m.MockReplicateService)
-		wantErr                  bool
+		name               string
+		labelSelector      metav1.LabelSelector
+		srcObjects         []*unstructured.Unstructured
+		importedObjects    []*unstructured.Unstructured
+		notImportedObjects []*unstructured.Unstructured
+		wantErr            bool
 	}{
 		{
-			name: "no error when Load and Snap are successful",
-			prepareEachServiceMockFn: func(simulatorExport *m.MockReplicateService, clusterExport *m.MockReplicateService) {
-				dummyOption := new(snapshot.Option)
-				clusterExport.EXPECT().Snap(gomock.Any(), gomock.Any()).Return(&snapshot.ResourcesForSnap{}, nil)
-				simulatorExport.EXPECT().Load(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
-				simulatorExport.EXPECT().IgnoreErr().Return(*dummyOption).Times(1)
-				simulatorExport.EXPECT().IgnoreSchedulerConfiguration().Return(*dummyOption).Times(1)
+			name:          "successfully import resources without label selector",
+			labelSelector: metav1.LabelSelector{},
+			srcObjects: []*unstructured.Unstructured{
+				podWithNameAndLabel("pod", nil),
+				podWithNameAndLabel("pod2", nil),
+			},
+			importedObjects: []*unstructured.Unstructured{
+				podWithNameAndLabel("pod", nil),
+				podWithNameAndLabel("pod2", nil),
 			},
 			wantErr: false,
 		},
 		{
-			name: "should return error if Load raise an error",
-			prepareEachServiceMockFn: func(simulatorExport *m.MockReplicateService, clusterExport *m.MockReplicateService) {
-				dummyOption := new(snapshot.Option)
-				clusterExport.EXPECT().Snap(gomock.Any(), gomock.Any()).Return(&snapshot.ResourcesForSnap{}, nil)
-				simulatorExport.EXPECT().Load(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(xerrors.Errorf("failed to Import"))
-				simulatorExport.EXPECT().IgnoreErr().Return(*dummyOption).Times(1)
-				simulatorExport.EXPECT().IgnoreSchedulerConfiguration().Return(*dummyOption).Times(1)
+			name: "successfully import resources filtered with label selector",
+			labelSelector: metav1.LabelSelector{
+				MatchLabels: map[string]string{"app": "test"},
 			},
-			wantErr: true,
-		},
-		{
-			name: "should return error if Snap raise an error",
-			prepareEachServiceMockFn: func(simulatorExport *m.MockReplicateService, clusterExport *m.MockReplicateService) {
-				dummyOption := new(snapshot.Option)
-				clusterExport.EXPECT().Snap(gomock.Any(), gomock.Any()).Return(nil, xerrors.Errorf("failed to Import"))
-				simulatorExport.EXPECT().Load(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(0)
-				simulatorExport.EXPECT().IgnoreSchedulerConfiguration().Return(*dummyOption).Times(0)
+			srcObjects: []*unstructured.Unstructured{
+				podWithNameAndLabel("test-pod-1", map[string]string{"app": "test"}),
+				podWithNameAndLabel("test-pod-2", map[string]string{"app": "test2"}),
+				podWithNameAndLabel("test-pod-3", nil),
+			},
+			importedObjects: []*unstructured.Unstructured{
+				podWithNameAndLabel("test-pod-1", map[string]string{"app": "test"}),
 			},
-			wantErr: true,
+			notImportedObjects: []*unstructured.Unstructured{
+				podWithNameAndLabel("test-pod-2", map[string]string{"app": "test2"}),
+				podWithNameAndLabel("test-pod-3", nil),
+			},
+			wantErr: false,
 		},
 	}
+
 	for _, tt := range tests {
 		tt := tt
 		t.Run(tt.name, func(t *testing.T) {
 			t.Parallel()
-			ctrl := gomock.NewController(t)
 
-			mockSimulatorExportService := m.NewMockReplicateService(ctrl)
-			mockClusterExportService := m.NewMockReplicateService(ctrl)
+			s := runtime.NewScheme()
+			v1.AddToScheme(s)
+			storage.AddToScheme(s)
+			scheduling.AddToScheme(s)
+			srcClient := fake.NewSimpleDynamicClient(s)
+			destClient := fake.NewSimpleDynamicClient(s)
+			applier := resourceapplier.New(destClient, mapper, resourceapplier.Options{})
+			oneshotImporter := NewService(srcClient, applier)
+			for _, obj := range tt.srcObjects {
+				gvr, err := findGVR(obj)
+				assert.NoError(t, err)
+				_, err = srcClient.Resource(gvr).Namespace(obj.GetNamespace()).Create(context.Background(), obj, metav1.CreateOptions{})
+				assert.NoError(t, err)
+			}
 
-			s := NewService(mockSimulatorExportService, mockClusterExportService)
-			tt.prepareEachServiceMockFn(mockSimulatorExportService, mockClusterExportService)
+			err := oneshotImporter.ImportClusterResources(context.Background(), tt.labelSelector)
 
-			if err := s.ImportClusterResources(context.Background(), metav1.LabelSelector{}); (err != nil) != tt.wantErr {
-				t.Fatalf("ImportClusterResources() %v test, \nerror = %v", tt.name, err)
+			if tt.wantErr {
+				assert.Error(t, err)
+				return
+			}
+			assert.NoError(t, err)
+			for _, want := range tt.importedObjects {
+				gvr, err := findGVR(want)
+				assert.NoError(t, err)
+				got, err := destClient.Resource(gvr).Namespace(want.GetNamespace()).Get(context.Background(), want.GetName(), metav1.GetOptions{})
+				assert.NoError(t, err)
+				assert.Equal(t, want.GetName(), got.GetName())
+			}
+			for _, notWant := range tt.notImportedObjects {
+				gvr, err := findGVR(notWant)
+				assert.NoError(t, err)
+				got, err := destClient.Resource(gvr).Namespace(notWant.GetNamespace()).Get(context.Background(), notWant.GetName(), metav1.GetOptions{})
+				assert.Error(t, err)
+				assert.Nil(t, got)
 			}
 		})
 	}
 }
+
+var mapper = restmapper.NewDiscoveryRESTMapper([]*restmapper.APIGroupResources{
+	{
+		Group: metav1.APIGroup{
+			Versions: []metav1.GroupVersionForDiscovery{
+				{Version: "v1"},
+			},
+		},
+		VersionedResources: map[string][]metav1.APIResource{
+			"v1": {
+				{Name: "pods", Namespaced: true, Kind: "Pod"},
+			},
+		},
+	},
+	{
+		Group: metav1.APIGroup{
+			Versions: []metav1.GroupVersionForDiscovery{
+				{Version: "v1"},
+			},
+		},
+		VersionedResources: map[string][]metav1.APIResource{
+			"v1": {
+				{Name: "nodes", Namespaced: false, Kind: "Node"},
+			},
+		},
+	},
+})
+
+func findGVR(obj *unstructured.Unstructured) (schema.GroupVersionResource, error) {
+	gvk := obj.GroupVersionKind()
+	m, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
+	if err != nil {
+		return schema.GroupVersionResource{}, err
+	}
+
+	return m.Resource, nil
+}
+
+func podWithNameAndLabel(name string, labels map[string]string) *unstructured.Unstructured {
+	pod := &unstructured.Unstructured{
+		Object: map[string]interface{}{
+			"apiVersion": "v1",
+			"kind":       "Pod",
+			"metadata": map[string]interface{}{
+				"name":      name,
+				"namespace": "default",
+			},
+			"spec": map[string]interface{}{
+				"containers": []interface{}{
+					map[string]interface{}{
+						"name":  "test-container",
+						"image": "test-image",
+					},
+				},
+			},
+		},
+	}
+
+	if labels != nil {
+		pod.SetLabels(labels)
+	}
+
+	return pod
+}
diff --git a/simulator/snapshot/snapshot_test.go b/simulator/snapshot/snapshot_test.go
index 24e59c1a..b6f12460 100644
--- a/simulator/snapshot/snapshot_test.go
+++ b/simulator/snapshot/snapshot_test.go
@@ -229,7 +229,6 @@ func TestService_Snap(t *testing.T) {
 		name                     string
 		prepareEachServiceMockFn func(*mock_snapshot.MockSchedulerService)
 		prepareFakeClientSetFn   func() *fake.Clientset
-		labelSelector            metav1.LabelSelector
 		wantReturn               func() *ResourcesForSnap
 		wantErr                  error
 	}{
@@ -521,60 +520,6 @@ func TestService_Snap(t *testing.T) {
 				return r
 			},
 		},
-		{
-			name: "Snap all Pods with different namespaces use labelSelector",
-			prepareEachServiceMockFn: func(ss *mock_snapshot.MockSchedulerService) {
-				ss.EXPECT().GetSchedulerConfig().Return(&configv1.KubeSchedulerConfiguration{}, nil)
-			},
-			prepareFakeClientSetFn: func() *fake.Clientset {
-				c := fake.NewSimpleClientset()
-				ctx := context.Background()
-				// add test data.
-				invokeResourcesFn(ctx, c, SettingClientFuncMap{
-					pod: func(_ context.Context, c *fake.Clientset) {
-						c.CoreV1().Pods(testNamespace1).Create(ctx, &corev1.Pod{
-							ObjectMeta: metav1.ObjectMeta{
-								Name: "pod1",
-								Labels: map[string]string{
-									"test": "test1",
-								},
-							},
-							Spec: corev1.PodSpec{
-								NodeName: "node1",
-							},
-						}, metav1.CreateOptions{})
-						c.CoreV1().Pods(testNamespace2).Create(ctx, &corev1.Pod{
-							ObjectMeta: metav1.ObjectMeta{
-								Name: "pod2",
-							},
-							Spec: corev1.PodSpec{
-								NodeName: "node1",
-							},
-						}, metav1.CreateOptions{})
-					},
-				}, defaultFuncs)
-				return c
-			},
-			labelSelector: metav1.LabelSelector{
-				MatchLabels: map[string]string{
-					"test": "test1",
-				},
-			},
-			wantReturn: func() *ResourcesForSnap {
-				r := &ResourcesForSnap{
-					Pods: []corev1.Pod{
-						{
-							ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"test": "test1"}, Namespace: testNamespace1},
-							Spec:       corev1.PodSpec{NodeName: "node1"},
-						},
-					},
-					PriorityClasses: []schedulingv1.PriorityClass{},
-					SchedulerConfig: &configv1.KubeSchedulerConfiguration{},
-					Namespaces:      []corev1.Namespace{},
-				}
-				return r
-			},
-		},
 	}
 	for _, tt := range tests {
 		tt := tt
@@ -586,7 +531,7 @@ func TestService_Snap(t *testing.T) {
 
 			s := NewService(fakeClientset, mockSchedulerSvc)
 			tt.prepareEachServiceMockFn(mockSchedulerSvc)
-			r, err := s.Snap(context.Background(), tt.labelSelector)
+			r, err := s.Snap(context.Background())
 
 			var diffResponse string
 			if tt.wantReturn != nil {
@@ -805,8 +750,7 @@ func TestService_Snap_IgnoreErrOption(t *testing.T) {
 			mockSchedulerSvc := mock_snapshot.NewMockSchedulerService(ctrl)
 			s := NewService(fakeClientset, mockSchedulerSvc)
 			tt.prepareEachServiceMockFn(mockSchedulerSvc)
-			var labels metav1.LabelSelector
-			r, err := s.Snap(context.Background(), labels, s.IgnoreErr())
+			r, err := s.Snap(context.Background(), s.IgnoreErr())
 
 			var diffResponse string
 			if tt.wantReturn != nil {
@@ -1921,7 +1865,6 @@ func TestFunction_listPcs(t *testing.T) {
 	tests := []struct {
 		name                   string
 		prepareFakeClientSetFn func() *fake.Clientset
-		labels                 metav1.LabelSelector
 		wantReturn             func() *ResourcesForSnap
 		wantErr                bool
 	}{
@@ -1973,68 +1916,6 @@ func TestFunction_listPcs(t *testing.T) {
 			},
 			wantErr: false,
 		},
-		{
-			name: "all priority classes that don't match a label selector should be filtered out",
-			labels: metav1.LabelSelector{
-				MatchLabels: map[string]string{
-					"env": "prod",
-				},
-			},
-			prepareFakeClientSetFn: func() *fake.Clientset {
-				c := fake.NewSimpleClientset()
-				ctx := context.Background()
-				// add test data.
-				invokeResourcesFn(ctx, c, SettingClientFuncMap{
-					pc: func(_ context.Context, c *fake.Clientset) {
-						c.PrependReactor("list", "priorityclasses", func(_ k8stesting.Action) (_ bool, _ runtime.Object, _ error) {
-							return true, &schedulingv1.PriorityClassList{
-								Items: []schedulingv1.PriorityClass{
-									{
-										ObjectMeta: metav1.ObjectMeta{
-											Name: "cluster-critical",
-											Labels: map[string]string{
-												"env": "dev",
-											},
-										},
-									},
-									{
-										ObjectMeta: metav1.ObjectMeta{
-											Name: "priority-class1",
-											Labels: map[string]string{
-												"env": "prod",
-											},
-										},
-									},
-								},
-							}, nil
-						})
-					},
-				}, defaultFuncs)
-				return c
-			},
-			wantReturn: func() *ResourcesForSnap {
-				_pcs := []schedulingv1.PriorityClass{
-					{
-						ObjectMeta: metav1.ObjectMeta{
-							Name: "priority-class1",
-							Labels: map[string]string{
-								"env": "prod",
-							},
-						},
-					},
-				}
-				return &ResourcesForSnap{
-					Pods:            []corev1.Pod{},
-					Nodes:           []corev1.Node{},
-					Pvs:             []corev1.PersistentVolume{},
-					Pvcs:            []corev1.PersistentVolumeClaim{},
-					StorageClasses:  []storagev1.StorageClass{},
-					PriorityClasses: _pcs,
-					SchedulerConfig: &configv1.KubeSchedulerConfiguration{},
-				}
-			},
-			wantErr: false,
-		},
 	}
 	for _, tt := range tests {
 		tt := tt
@@ -2058,7 +1939,7 @@ func TestFunction_listPcs(t *testing.T) {
 				SchedulerConfig: &configv1.KubeSchedulerConfiguration{},
 			}
 
-			err := s.listPcs(context.Background(), resources, errgrp, tt.labels, options{})
+			err := s.listPcs(context.Background(), resources, errgrp, options{})
 			if err := errgrp.Wait(); err != nil {
 				t.Fatalf("listPcs: %v", err)
 			}