Skip to content

Commit

Permalink
refactor: follower controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlihanbo committed Jul 21, 2023
1 parent e56fb93 commit 739969d
Show file tree
Hide file tree
Showing 7 changed files with 271 additions and 237 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions cmd/controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (

var knownControllers = map[string]controllermanager.StartControllerFunc{
FederateControllerName: startFederateController,
FollowerControllerName: startFollowerController,
}

var controllersDisabledByDefault = sets.New(MonitorControllerName)
Expand Down
20 changes: 20 additions & 0 deletions cmd/controller-manager/app/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/kubewharf/kubeadmiral/pkg/controllermanager"
controllercontext "github.com/kubewharf/kubeadmiral/pkg/controllers/context"
"github.com/kubewharf/kubeadmiral/pkg/controllers/federate"
"github.com/kubewharf/kubeadmiral/pkg/controllers/follower"
)

func startFederateController(
Expand All @@ -51,3 +52,22 @@ func startFederateController(

return federateController, nil
}

func startFollowerController(ctx context.Context, controllerCtx *controllercontext.Context) (controllermanager.Controller, error) {
controller, err := follower.NewFollowerController(

Check failure on line 57 in cmd/controller-manager/app/core.go

View workflow job for this annotation

GitHub Actions / lint

Function `NewFollowerController` should pass the context parameter (contextcheck)
controllerCtx.KubeClientset,
controllerCtx.FedClientset,
controllerCtx.FedInformerFactory.Core().V1alpha1().FederatedObjects(),
controllerCtx.FedInformerFactory.Core().V1alpha1().ClusterFederatedObjects(),
controllerCtx.Metrics,
klog.Background(),
controllerCtx.WorkerCount,
)
if err != nil {
return nil, fmt.Errorf("error creating follower controller: %w", err)
}

go controller.Run(ctx)

return controller, nil
}
1 change: 0 additions & 1 deletion pkg/controllers/follower/bidirectional_cache.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//go:build exclude
/*
Copyright 2023 The KubeAdmiral Authors.
Expand Down
Loading

0 comments on commit 739969d

Please sign in to comment.