@@ -41,6 +41,7 @@ import (
41
41
servicecatalogclientset "github.com/kubernetes-incubator/service-catalog/pkg/client/clientset_generated/clientset/typed/servicecatalog/v1beta1"
42
42
informers "github.com/kubernetes-incubator/service-catalog/pkg/client/informers_generated/externalversions/servicecatalog/v1beta1"
43
43
listers "github.com/kubernetes-incubator/service-catalog/pkg/client/listers_generated/servicecatalog/v1beta1"
44
+ pretty "github.com/kubernetes-incubator/service-catalog/pkg/pretty"
44
45
)
45
46
46
47
const (
@@ -247,16 +248,14 @@ func worker(queue workqueue.RateLimitingInterface, resourceType string, maxRetri
247
248
// a brokerClient to use for that method given an ServiceInstance.
248
249
// Sets ClusterServiceClassRef and/or ClusterServicePlanRef if they haven't been already set.
249
250
func (c * controller ) getClusterServiceClassPlanAndClusterServiceBroker (instance * v1beta1.ServiceInstance ) (* v1beta1.ClusterServiceClass , * v1beta1.ClusterServicePlan , string , osb.Client , error ) {
251
+ pcb := pretty .NewContextBuilder (pretty .ServiceInstance , instance .Namespace , instance .Name )
250
252
serviceClass , err := c .serviceClassLister .Get (instance .Spec .ClusterServiceClassRef .Name )
251
253
if err != nil {
252
254
s := fmt .Sprintf (
253
255
"References a non-existent ClusterServiceClass (K8S: %q ExternalName: %q)" ,
254
256
instance .Spec .ClusterServiceClassRef .Name , instance .Spec .ExternalClusterServiceClassName ,
255
257
)
256
- glog .Infof (
257
- `ServiceInstance "%v/%v": %s` ,
258
- instance .Namespace , instance .Name , s ,
259
- )
258
+ glog .Info (pcb .Message (s ))
260
259
c .updateServiceInstanceCondition (
261
260
instance ,
262
261
v1beta1 .ServiceInstanceConditionReady ,
@@ -274,10 +273,7 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBroker(instance
274
273
"References a non-existent ClusterServicePlan (K8S: %q ExternalName: %q) on ClusterServiceClass (K8S: %q ExternalName: %q)" ,
275
274
instance .Spec .ClusterServicePlanName , instance .Spec .ExternalClusterServicePlanName , serviceClass .Name , serviceClass .Spec .ExternalName ,
276
275
)
277
- glog .Warningf (
278
- `ServiceInstance "%s/%s": %s` ,
279
- instance .Namespace , instance .Name , s ,
280
- )
276
+ glog .Warning (pcb .Message (s ))
281
277
c .updateServiceInstanceCondition (
282
278
instance ,
283
279
v1beta1 .ServiceInstanceConditionReady ,
@@ -292,10 +288,7 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBroker(instance
292
288
broker , err := c .brokerLister .Get (serviceClass .Spec .ClusterServiceBrokerName )
293
289
if err != nil {
294
290
s := fmt .Sprintf ("References a non-existent broker %q" , serviceClass .Spec .ClusterServiceBrokerName )
295
- glog .Warningf (
296
- `ServiceInstance "%s/%s": %s` ,
297
- instance .Namespace , instance .Name , s ,
298
- )
291
+ glog .Warning (pcb .Message (s ))
299
292
c .updateServiceInstanceCondition (
300
293
instance ,
301
294
v1beta1 .ServiceInstanceConditionReady ,
@@ -310,10 +303,7 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBroker(instance
310
303
authConfig , err := getAuthCredentialsFromClusterServiceBroker (c .kubeClient , broker )
311
304
if err != nil {
312
305
s := fmt .Sprintf ("Error getting broker auth credentials for broker %q: %s" , broker .Name , err )
313
- glog .Infof (
314
- `ServiceInstance "%v/%v": %s` ,
315
- instance .Namespace , instance .Name , s ,
316
- )
306
+ glog .Info (pcb .Message (s ))
317
307
c .updateServiceInstanceCondition (
318
308
instance ,
319
309
v1beta1 .ServiceInstanceConditionReady ,
@@ -327,7 +317,8 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBroker(instance
327
317
328
318
clientConfig := NewClientConfigurationForBroker (broker , authConfig )
329
319
330
- glog .V (4 ).Infof ("Creating client for ClusterServiceBroker %v, URL: %v" , broker .Name , broker .Spec .URL )
320
+ s := fmt .Sprintf ("Creating client for ClusterServiceBroker %v, URL: %v" , broker .Name , broker .Spec .URL )
321
+ glog .V (4 ).Info (pcb .Message (s ))
331
322
brokerClient , err := c .brokerClientCreateFunc (clientConfig )
332
323
if err != nil {
333
324
return nil , nil , "" , nil , err
@@ -341,16 +332,14 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBroker(instance
341
332
// a brokerclient to use for a given ServiceInstance.
342
333
// Sets ClusterServiceClassRef and/or ClusterServicePlanRef if they haven't been already set.
343
334
func (c * controller ) getClusterServiceClassPlanAndClusterServiceBrokerForServiceBinding (instance * v1beta1.ServiceInstance , binding * v1beta1.ServiceBinding ) (* v1beta1.ClusterServiceClass , * v1beta1.ClusterServicePlan , string , osb.Client , error ) {
335
+ pcb := pretty .NewContextBuilder (pretty .ServiceInstance , instance .Namespace , instance .Name )
344
336
serviceClass , err := c .serviceClassLister .Get (instance .Spec .ClusterServiceClassRef .Name )
345
337
if err != nil {
346
338
s := fmt .Sprintf (
347
339
"References a non-existent ClusterServiceClass (K8S: %q ExternalName: %q)" ,
348
340
instance .Spec .ClusterServiceClassRef .Name , instance .Spec .ExternalClusterServiceClassName ,
349
341
)
350
- glog .Warningf (
351
- `ServiceBinding "%s/%s": %s` ,
352
- instance .Namespace , instance .Name , s ,
353
- )
342
+ glog .Warning (pcb .Message (s ))
354
343
c .updateServiceBindingCondition (
355
344
binding ,
356
345
v1beta1 .ServiceBindingConditionReady ,
@@ -368,10 +357,7 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBrokerForService
368
357
"References a non-existent ClusterServicePlan (K8S: %q ExternalName: %q) on ClusterServiceClass (K8S: %q ExternalName: %q)" ,
369
358
instance .Spec .ClusterServicePlanName , instance .Spec .ExternalClusterServicePlanName , serviceClass .Name , serviceClass .Spec .ExternalName ,
370
359
)
371
- glog .Warningf (
372
- `ServiceBinding "%s/%s": %s` ,
373
- instance .Namespace , instance .Name , s ,
374
- )
360
+ glog .Warning (pcb .Message (s ))
375
361
c .updateServiceBindingCondition (
376
362
binding ,
377
363
v1beta1 .ServiceBindingConditionReady ,
@@ -386,10 +372,7 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBrokerForService
386
372
broker , err := c .brokerLister .Get (serviceClass .Spec .ClusterServiceBrokerName )
387
373
if err != nil {
388
374
s := fmt .Sprintf ("References a non-existent ClusterServiceBroker %q" , serviceClass .Spec .ClusterServiceBrokerName )
389
- glog .Warningf (
390
- `ServiceBinding "%s/%s": %s` ,
391
- instance .Namespace , instance .Name , s ,
392
- )
375
+ glog .Warning (pcb .Message (s ))
393
376
c .updateServiceBindingCondition (
394
377
binding ,
395
378
v1beta1 .ServiceBindingConditionReady ,
@@ -404,10 +387,7 @@ func (c *controller) getClusterServiceClassPlanAndClusterServiceBrokerForService
404
387
authConfig , err := getAuthCredentialsFromClusterServiceBroker (c .kubeClient , broker )
405
388
if err != nil {
406
389
s := fmt .Sprintf ("Error getting broker auth credentials for broker %q: %s" , broker .Name , err )
407
- glog .Warningf (
408
- `ServiceBinding "%s/%s": %s` ,
409
- instance .Namespace , instance .Name , s ,
410
- )
390
+ glog .Warning (pcb .Message (s ))
411
391
c .updateServiceBindingCondition (
412
392
binding ,
413
393
v1beta1 .ServiceBindingConditionReady ,
0 commit comments