Skip to content

Commit

Permalink
Reduce kruise-manager memory allocation (#1015)
Browse files Browse the repository at this point in the history
Signed-off-by: FillZpp <FillZpp.pub@gmail.com>
  • Loading branch information
FillZpp authored Jul 5, 2022
1 parent fb5fc11 commit 5380c57
Show file tree
Hide file tree
Showing 36 changed files with 229 additions and 309 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func main() {
LeaderElectionResourceLock: resourcelock.ConfigMapsResourceLock,
Namespace: namespace,
SyncPeriod: syncPeriod,
NewClient: utilclient.NewClient,
NewCache: utilclient.NewCache,
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/advancedcronjob/advancedcronjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"time"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -64,7 +64,7 @@ func Add(mgr manager.Manager) error {
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
recorder := mgr.GetEventRecorderFor("advancedcronjob-controller")
return &ReconcileAdvancedCronJob{
Client: util.NewClientFromManager(mgr, "advancedcronjob-controller"),
Client: utilclient.NewClientFromManager(mgr, "advancedcronjob-controller"),
scheme: mgr.GetScheme(),
recorder: recorder,
Clock: realClock{},
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/broadcastjob/broadcastjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"time"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/expectations"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
Expand Down Expand Up @@ -89,7 +89,7 @@ func Add(mgr manager.Manager) error {
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
recorder := mgr.GetEventRecorderFor("broadcastjob-controller")
return &ReconcileBroadcastJob{
Client: util.NewClientFromManager(mgr, "broadcastjob-controller"),
Client: utilclient.NewClientFromManager(mgr, "broadcastjob-controller"),
scheme: mgr.GetScheme(),
recorder: recorder,
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/cloneset/cloneset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
synccontrol "github.com/openkruise/kruise/pkg/controller/cloneset/sync"
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
"github.com/openkruise/kruise/pkg/features"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/expectations"
Expand Down Expand Up @@ -95,7 +94,7 @@ func newReconciler(mgr manager.Manager) reconcile.Reconciler {
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: cli.KubeClient.CoreV1().Events("")})
recorder = eventBroadcaster.NewRecorder(mgr.GetScheme(), v1.EventSource{Component: "cloneset-controller"})
}
cli := util.NewClientFromManager(mgr, "cloneset-controller")
cli := utilclient.NewClientFromManager(mgr, "cloneset-controller")
reconciler := &ReconcileCloneSet{
Client: cli,
scheme: mgr.GetScheme(),
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/cloneset/cloneset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
"github.com/openkruise/kruise/pkg/features"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
"github.com/openkruise/kruise/pkg/util/fieldindex"
"golang.org/x/net/context"
Expand Down Expand Up @@ -91,7 +92,7 @@ func TestReconcile(t *testing.T) {
mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"})
_ = fieldindex.RegisterFieldIndexes(mgr.GetCache())
g.Expect(err).NotTo(gomega.HaveOccurred())
c = util.NewClientFromManager(mgr, "test-cloneset-controller")
c = utilclient.NewClientFromManager(mgr, "test-cloneset-controller")

//recFn, requests := SetupTestReconcile(newReconciler(mgr))
g.Expect(add(mgr, newReconciler(mgr))).NotTo(gomega.HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strconv"
"time"

"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utilcontainerlaunchpriority "github.com/openkruise/kruise/pkg/util/containerlaunchpriority"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -52,7 +52,7 @@ func Add(mgr manager.Manager) error {
// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) *ReconcileContainerLaunchPriority {
return &ReconcileContainerLaunchPriority{
Client: util.NewClientFromManager(mgr, "container-launch-priority-controller"),
Client: utilclient.NewClientFromManager(mgr, "container-launch-priority-controller"),
recorder: mgr.GetEventRecorderFor("container-launch-priority-controller"),
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/containerrecreaterequest/crr_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/features"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
utilpodreadiness "github.com/openkruise/kruise/pkg/util/podreadiness"
Expand Down Expand Up @@ -70,7 +71,7 @@ func Add(mgr manager.Manager) error {

// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) *ReconcileContainerRecreateRequest {
cli := util.NewClientFromManager(mgr, "containerrecreaterequest-controller")
cli := utilclient.NewClientFromManager(mgr, "containerrecreaterequest-controller")
return &ReconcileContainerRecreateRequest{
Client: cli,
clock: clock.RealClock{},
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/daemonset/daemonset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import (
"github.com/openkruise/kruise/pkg/client/clientset/versioned/scheme"
kruiseappslisters "github.com/openkruise/kruise/pkg/client/listers/apps/v1alpha1"
kruiseutil "github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
kruiseExpectations "github.com/openkruise/kruise/pkg/util/expectations"
"github.com/openkruise/kruise/pkg/util/inplaceupdate"
Expand Down Expand Up @@ -168,7 +169,7 @@ func newReconciler(mgr manager.Manager) (reconcile.Reconciler, error) {
failedPodsBackoff := flowcontrol.NewBackOff(1*time.Second, 15*time.Minute)
revisionAdapter := revisionadapter.NewDefaultImpl()

cli := kruiseutil.NewClientFromManager(mgr, "daemonset-controller")
cli := utilclient.NewClientFromManager(mgr, "daemonset-controller")
dsc := &ReconcileDaemonSet{
kubeClient: genericClient.KubeClient,
kruiseClient: genericClient.KruiseClient,
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/ephemeraljob/ephemeraljob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
clonesetutils "github.com/openkruise/kruise/pkg/controller/cloneset/utils"
"github.com/openkruise/kruise/pkg/controller/ephemeraljob/econtainer"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/expectations"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -64,7 +65,7 @@ func Add(mgr manager.Manager) error {
// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) *ReconcileEphemeralJob {
return &ReconcileEphemeralJob{
Client: util.NewClientFromManager(mgr, "ephemeraljob-controller"),
Client: utilclient.NewClientFromManager(mgr, "ephemeraljob-controller"),
scheme: mgr.GetScheme(),
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/imagepulljob/imagepulljob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
daemonutil "github.com/openkruise/kruise/pkg/daemon/util"
"github.com/openkruise/kruise/pkg/features"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/expectations"
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
Expand Down Expand Up @@ -74,7 +75,7 @@ func Add(mgr manager.Manager) error {
// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) *ReconcileImagePullJob {
return &ReconcileImagePullJob{
Client: util.NewClientFromManager(mgr, "imagepulljob-controller"),
Client: utilclient.NewClientFromManager(mgr, "imagepulljob-controller"),
scheme: mgr.GetScheme(),
clock: clock.RealClock{},
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/nodeimage/nodeimage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
kruiseclient "github.com/openkruise/kruise/pkg/client"
"github.com/openkruise/kruise/pkg/features"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
utilimagejob "github.com/openkruise/kruise/pkg/util/imagejob"
Expand Down Expand Up @@ -92,7 +93,7 @@ func newReconciler(mgr manager.Manager) reconcile.Reconciler {
recorder = eventBroadcaster.NewRecorder(mgr.GetScheme(), v1.EventSource{Component: controllerName})
}
return &ReconcileNodeImage{
Client: util.NewClientFromManager(mgr, controllerName),
Client: utilclient.NewClientFromManager(mgr, controllerName),
scheme: mgr.GetScheme(),
clock: clock.RealClock{},
eventRecorder: recorder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
"github.com/openkruise/kruise/pkg/util/controllerfinder"
"github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
Expand Down Expand Up @@ -80,7 +81,7 @@ func Add(mgr manager.Manager) error {

// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
cli := util.NewClientFromManager(mgr, "persistentpodstate-controller")
cli := utilclient.NewClientFromManager(mgr, "persistentpodstate-controller")
return &ReconcilePersistentPodState{
Client: cli,
scheme: mgr.GetScheme(),
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/podreadiness/pod_readiness_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

appspub "github.com/openkruise/kruise/apis/apps/pub"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utilpodreadiness "github.com/openkruise/kruise/pkg/util/podreadiness"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -49,7 +49,7 @@ func Add(mgr manager.Manager) error {
// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) *ReconcilePodReadiness {
return &ReconcilePodReadiness{
Client: util.NewClientFromManager(mgr, "pod-readiness-controller"),
Client: utilclient.NewClientFromManager(mgr, "pod-readiness-controller"),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ import (
"fmt"
"reflect"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/util"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
utils "github.com/openkruise/kruise/pkg/webhook/resourcedistribution/validating"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand All @@ -45,6 +39,12 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
utils "github.com/openkruise/kruise/pkg/webhook/resourcedistribution/validating"
)

func init() {
Expand All @@ -67,7 +67,7 @@ func Add(mgr manager.Manager) error {

// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
cli := util.NewClientFromManager(mgr, "resourcedistribution-controller")
cli := utilclient.NewClientFromManager(mgr, "resourcedistribution-controller")
return &ReconcileResourceDistribution{
Client: cli,
scheme: mgr.GetScheme(),
Expand Down
16 changes: 8 additions & 8 deletions pkg/controller/sidecarset/sidecarset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ import (
"context"
"flag"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/control/sidecarcontrol"
"github.com/openkruise/kruise/pkg/util"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/expectations"
"github.com/openkruise/kruise/pkg/util/ratelimiter"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -39,6 +32,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/control/sidecarcontrol"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/expectations"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
)

func init() {
Expand Down Expand Up @@ -68,7 +68,7 @@ func Add(mgr manager.Manager) error {
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
expectations := expectations.NewUpdateExpectations(sidecarcontrol.RevisionAdapterImpl)
recorder := mgr.GetEventRecorderFor("sidecarset-controller")
cli := util.NewClientFromManager(mgr, "sidecarset-controller")
cli := utilclient.NewClientFromManager(mgr, "sidecarset-controller")
return &ReconcileSidecarSet{
Client: cli,
scheme: mgr.GetScheme(),
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/statefulset/statefulset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import (
kruiseclientset "github.com/openkruise/kruise/pkg/client/clientset/versioned"
kruiseappslisters "github.com/openkruise/kruise/pkg/client/listers/apps/v1beta1"
"github.com/openkruise/kruise/pkg/features"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/expectations"
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
Expand Down Expand Up @@ -137,7 +137,7 @@ func newReconciler(mgr manager.Manager) (reconcile.Reconciler, error) {
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "statefulset-controller"})

// new a client
sigsruntimeClient = util.NewClientFromManager(mgr, "statefulset-controller")
sigsruntimeClient = utilclient.NewClientFromManager(mgr, "statefulset-controller")

return &ReconcileStatefulSet{
kruiseClient: genericClient.KruiseClient,
Expand All @@ -148,8 +148,8 @@ func newReconciler(mgr manager.Manager) (reconcile.Reconciler, error) {
podLister,
pvcLister,
recorder),
inplaceupdate.New(util.NewClientFromManager(mgr, "statefulset-controller"), revisionadapter.NewDefaultImpl()),
lifecycle.New(util.NewClientFromManager(mgr, "statefulset-controller")),
inplaceupdate.New(utilclient.NewClientFromManager(mgr, "statefulset-controller"), revisionadapter.NewDefaultImpl()),
lifecycle.New(utilclient.NewClientFromManager(mgr, "statefulset-controller")),
NewRealStatefulSetStatusUpdater(genericClient.KruiseClient, statefulSetLister),
history.NewHistory(genericClient.KubeClient, appslisters.NewControllerRevisionLister(revInformer.(toolscache.SharedIndexInformer).GetIndexer())),
recorder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
"github.com/openkruise/kruise/pkg/controller/uniteddeployment/adapter"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -83,7 +83,7 @@ func Add(mgr manager.Manager) error {

// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
cli := util.NewClientFromManager(mgr, "uniteddeployment-controller")
cli := utilclient.NewClientFromManager(mgr, "uniteddeployment-controller")
return &ReconcileUnitedDeployment{
Client: cli,
scheme: mgr.GetScheme(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
kruisectlutil "github.com/openkruise/kruise/pkg/controller/util"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
)

var c client.Client
Expand Down Expand Up @@ -1610,7 +1610,7 @@ func setUp(t *testing.T) (*gomega.GomegaWithT, chan reconcile.Request, context.C
// channel when it is finished.
mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"})
g.Expect(err).NotTo(gomega.HaveOccurred())
c = util.NewClientFromManager(mgr, "test-uniteddeployment-controller")
c = utilclient.NewClientFromManager(mgr, "test-uniteddeployment-controller")
recFn, requests := SetupTestReconcile(newReconciler(mgr))
g.Expect(add(mgr, recFn)).NotTo(gomega.HaveOccurred())
ctx, cancel := context.WithCancel(context.Background())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/onsi/gomega"
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
"golang.org/x/net/context"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestReconcile(t *testing.T) {
// channel when it is finished.
mgr, err := manager.New(cfg, manager.Options{})
g.Expect(err).NotTo(gomega.HaveOccurred())
c = util.NewClientFromManager(mgr, "test-uniteddeployment-controller")
c = utilclient.NewClientFromManager(mgr, "test-uniteddeployment-controller")

recFn, requests := SetupTestReconcile(newReconciler(mgr))
g.Expect(add(mgr, recFn)).NotTo(gomega.HaveOccurred())
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/workloadspread/workloadspread_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/util"
utilclient "github.com/openkruise/kruise/pkg/util/client"
"github.com/openkruise/kruise/pkg/util/controllerfinder"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/fieldindex"
Expand Down Expand Up @@ -149,7 +150,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {

// newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
cli := util.NewClientFromManager(mgr, controllerName)
cli := utilclient.NewClientFromManager(mgr, controllerName)
return &ReconcileWorkloadSpread{
Client: cli,
scheme: mgr.GetScheme(),
Expand Down
Loading

0 comments on commit 5380c57

Please sign in to comment.