@@ -121,7 +121,10 @@ func NewDefaultObjectStorageController(identity string, leaderLockName string, t
121
121
122
122
func NewObjectStorageController (identity string , leaderLockName string , threads int , limiter workqueue.RateLimiter ) (* ObjectStorageController , error ) {
123
123
cfg , err := func () (* rest.Config , error ) {
124
- kubeConfig := viper .GetString ("kube-config" )
124
+ kubeConfig := viper .GetString ("kubeconfig" )
125
+ if kubeConfig == "" {
126
+ kubeConfig = os .Getenv ("KUBECONFIG" )
127
+ }
125
128
126
129
if kubeConfig != "" {
127
130
return clientcmd .BuildConfigFromFlags ("" , kubeConfig )
@@ -140,8 +143,12 @@ func NewObjectStorageController(identity string, leaderLockName string, threads
140
143
if err != nil {
141
144
return nil , err
142
145
}
146
+ return NewObjectStorageControllerWithClientset (identity , leaderLockName , threads , limiter , kubeClient , bucketClient )
147
+ }
143
148
149
+ func NewObjectStorageControllerWithClientset (identity string , leaderLockName string , threads int , limiter workqueue.RateLimiter , kubeClient kubeclientset.Interface , bucketClient bucketclientset.Interface ) (* ObjectStorageController , error ) {
144
150
id := identity
151
+ var err error
145
152
if id == "" {
146
153
id , err = os .Hostname ()
147
154
if err != nil {
@@ -225,7 +232,7 @@ func (c *ObjectStorageController) Run(ctx context.Context) error {
225
232
c .runController (ctx )
226
233
},
227
234
OnStoppedLeading : func () {
228
- glog .Fatal ("stopped leading" )
235
+ glog .Infof ("stopped leading" )
229
236
},
230
237
OnNewLeader : func (identity string ) {
231
238
glog .V (3 ).Infof ("new leader detected, current leader: %s" , identity )
@@ -416,7 +423,7 @@ func (c *ObjectStorageController) runController(ctx context.Context) {
416
423
defer utilruntime .HandleCrash ()
417
424
defer c .queue .ShutDown ()
418
425
419
- glog .V (3 ).Infof ("Starting %s controller" , name )
426
+ glog .V (1 ).Infof ("Starting %s controller" , name )
420
427
go ctrlr .Run (ctx .Done ())
421
428
422
429
if ! cache .WaitForCacheSync (ctx .Done (), ctrlr .HasSynced ) {
0 commit comments