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

Commit 4353934

Browse files
authored
Merge pull request #7 from brahmaroutu/add_contructor
Adding new method to create controoler with clientset.
2 parents b97135e + b30ad81 commit 4353934

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: controller/controller.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ func NewObjectStorageController(identity string, leaderLockName string, threads
142142
if err != nil {
143143
return nil, err
144144
}
145+
return NewObjectStorageControllerWithClientset(identity, leaderLockName, threads, limiter, kubeClient, bucketClient)
146+
}
145147

148+
func NewObjectStorageControllerWithClientset(identity string, leaderLockName string, threads int, limiter workqueue.RateLimiter, kubeClient kubeclientset.Interface, bucketClient bucketclientset.Interface) (*ObjectStorageController, error) {
146149
id := identity
150+
var err error
147151
if id == "" {
148152
id, err = os.Hostname()
149153
if err != nil {
@@ -227,7 +231,7 @@ func (c *ObjectStorageController) Run(ctx context.Context) error {
227231
c.runController(ctx)
228232
},
229233
OnStoppedLeading: func() {
230-
glog.Fatal("stopped leading")
234+
glog.Infof("stopped leading")
231235
},
232236
OnNewLeader: func(identity string) {
233237
glog.V(3).Infof("new leader detected, current leader: %s", identity)
@@ -418,7 +422,7 @@ func (c *ObjectStorageController) runController(ctx context.Context) {
418422
defer utilruntime.HandleCrash()
419423
defer c.queue.ShutDown()
420424

421-
glog.V(3).Infof("Starting %s controller", name)
425+
glog.V(1).Infof("Starting %s controller", name)
422426
go ctrlr.Run(ctx.Done())
423427

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

0 commit comments

Comments
 (0)