Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Adding new method to create controoler with clientset. #7

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,12 @@ func NewObjectStorageController(identity string, leaderLockName string, threads
if err != nil {
return nil, err
}
return NewObjectStorageControllerWithClientset(identity, leaderLockName, threads, limiter, kubeClient, bucketClient)
}

func NewObjectStorageControllerWithClientset(identity string, leaderLockName string, threads int, limiter workqueue.RateLimiter, kubeClient kubeclientset.Interface, bucketClient bucketclientset.Interface) (*ObjectStorageController, error) {
id := identity
var err error
if id == "" {
id, err = os.Hostname()
if err != nil {
Expand Down Expand Up @@ -227,7 +231,7 @@ func (c *ObjectStorageController) Run(ctx context.Context) error {
c.runController(ctx)
},
OnStoppedLeading: func() {
glog.Fatal("stopped leading")
glog.Infof("stopped leading")
},
OnNewLeader: func(identity string) {
glog.V(3).Infof("new leader detected, current leader: %s", identity)
Expand Down Expand Up @@ -418,7 +422,7 @@ func (c *ObjectStorageController) runController(ctx context.Context) {
defer utilruntime.HandleCrash()
defer c.queue.ShutDown()

glog.V(3).Infof("Starting %s controller", name)
glog.V(1).Infof("Starting %s controller", name)
go ctrlr.Run(ctx.Done())

if !cache.WaitForCacheSync(ctx.Done(), ctrlr.HasSynced) {
Expand Down