Skip to content

Commit 2d74aee

Browse files
authored
Use Structure Logging Enhancement for Cluster Resource Binding Controller (#6576)
* use structured logging for cluster resource binding controller Signed-off-by: zhuyulicfc49 <[email protected]> * Improve logs by using 'name' as key and log name only Signed-off-by: zhuyulicfc49 <[email protected]> --------- Signed-off-by: zhuyulicfc49 <[email protected]>
1 parent cb0acc0 commit 2d74aee

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/controllers/status/crb_status_controller.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type CRBStatusController struct {
5858
// The Controller will requeue the Request to be processed again if an error is non-nil or
5959
// Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
6060
func (c *CRBStatusController) Reconcile(ctx context.Context, req controllerruntime.Request) (controllerruntime.Result, error) {
61-
klog.V(4).Infof("Reconciling ClusterResourceBinding %s.", req.NamespacedName.String())
61+
klog.V(4).InfoS("Reconciling ClusterResourceBinding", "name", req.NamespacedName.Name)
6262

6363
binding := &workv1alpha2.ClusterResourceBinding{}
6464
if err := c.Client.Get(ctx, req.NamespacedName, binding); err != nil {
@@ -112,8 +112,7 @@ func (c *CRBStatusController) SetupWithManager(mgr controllerruntime.Manager) er
112112
func (c *CRBStatusController) syncBindingStatus(ctx context.Context, binding *workv1alpha2.ClusterResourceBinding) error {
113113
err := helper.AggregateClusterResourceBindingWorkStatus(ctx, c.Client, binding, c.EventRecorder)
114114
if err != nil {
115-
klog.Errorf("Failed to aggregate workStatues to clusterResourceBinding(%s), Error: %v",
116-
binding.Name, err)
115+
klog.ErrorS(err, "Failed to aggregate workStatues to clusterResourceBinding", "name", binding.Name)
117116
return err
118117
}
119118

0 commit comments

Comments
 (0)