@@ -59,7 +59,7 @@ type RBApplicationFailoverController struct {
59
59
// The Controller will requeue the Request to be processed again if an error is non-nil or
60
60
// Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
61
61
func (c * RBApplicationFailoverController ) Reconcile (ctx context.Context , req controllerruntime.Request ) (controllerruntime.Result , error ) {
62
- klog .V (4 ).Infof ("Reconciling ResourceBinding %s." , req .NamespacedName . String () )
62
+ klog .V (4 ).InfoS ("Reconciling ResourceBinding" , "namespace" , req . Namespace , "name" , req .Name )
63
63
64
64
binding := & workv1alpha2.ResourceBinding {}
65
65
if err := c .Client .Get (ctx , req .NamespacedName , binding ); err != nil {
@@ -80,7 +80,7 @@ func (c *RBApplicationFailoverController) Reconcile(ctx context.Context, req con
80
80
return controllerruntime.Result {}, err
81
81
}
82
82
if retryDuration > 0 {
83
- klog .V (4 ).Infof ("Retry to check health status of the workload after %v seconds. " , retryDuration .Seconds ())
83
+ klog .V (4 ).InfoS ("Retry to check health status of the workload" , "afterSeconds " , retryDuration .Seconds ())
84
84
return controllerruntime.Result {RequeueAfter : retryDuration }, nil
85
85
}
86
86
return controllerruntime.Result {}, nil
@@ -132,7 +132,7 @@ func (c *RBApplicationFailoverController) syncBinding(ctx context.Context, bindi
132
132
133
133
err := c .evictBinding (binding , needEvictClusters )
134
134
if err != nil {
135
- klog .Errorf ( "Failed to evict binding(%s/%s), err: %v." , binding .Namespace , binding .Name , err )
135
+ klog .ErrorS ( err , "Failed to evict binding" , "namespace" , binding .Namespace , "name" , binding .Name )
136
136
return 0 , err
137
137
}
138
138
@@ -153,7 +153,10 @@ func (c *RBApplicationFailoverController) evictBinding(binding *workv1alpha2.Res
153
153
for _ , cluster := range clusters {
154
154
taskOpts , err := buildTaskOptions (binding .Spec .Failover .Application , binding .Status .AggregatedStatus , cluster , RBApplicationFailoverControllerName , clustersBeforeFailover )
155
155
if err != nil {
156
- klog .Errorf ("failed to build TaskOptions for ResourceBinding(%s/%s) under Cluster(%s): %v" , binding .Namespace , binding .Name , cluster , err )
156
+ klog .ErrorS (err , "Failed to build TaskOptions for ResourceBinding under Cluster" ,
157
+ "namespace" , binding .Namespace ,
158
+ "name" , binding .Name ,
159
+ "cluster" , cluster )
157
160
return err
158
161
}
159
162
binding .Spec .GracefulEvictCluster (cluster , workv1alpha2 .NewTaskOptions (taskOpts ... ))
@@ -225,7 +228,7 @@ func (c *RBApplicationFailoverController) bindingFilter(rb *workv1alpha2.Resourc
225
228
resourceKey , err := helper .ConstructClusterWideKey (rb .Spec .Resource )
226
229
if err != nil {
227
230
// Never reach
228
- klog .Errorf ( "Failed to construct clusterWideKey from binding(%s/%s) " , rb .Namespace , rb .Name )
231
+ klog .ErrorS ( err , "Failed to construct clusterWideKey from binding" , "namespace" , rb .Namespace , "name" , rb .Name )
229
232
return false
230
233
}
231
234
0 commit comments