Skip to content

Commit a2c2057

Browse files
authored
Use structured log for karmada operator (#6564)
* use structured log Signed-off-by: zhangsquared <[email protected]> * addressing comment Signed-off-by: zhangsquared <[email protected]> --------- Signed-off-by: zhangsquared <[email protected]>
1 parent a2980eb commit a2c2057

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

operator/pkg/controller/karmada/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (ctrl *Controller) Reconcile(ctx context.Context, req controllerruntime.Req
9797
}
9898

9999
if err := ctrl.validateKarmada(ctx, karmada); err != nil {
100-
klog.Errorf("Validation failed for karmada: %+v", err)
100+
klog.ErrorS(err, "Validation failed for karmada", "name", karmada.Name)
101101
return controllerruntime.Result{}, nil
102102
}
103103

operator/pkg/controller/karmada/validating.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func validateETCD(etcd *operatorv1alpha1.Etcd, karmadaName string, fldPath *fiel
8080
replicas := *etcd.Local.CommonSettings.Replicas
8181

8282
if (replicas % 2) == 0 {
83-
klog.Warningf("invalid etcd replicas %d, expected an odd number", replicas)
83+
klog.InfoS("Using an even number of etcd replicas is not recommended", "replicas", replicas)
8484
}
8585
}
8686

0 commit comments

Comments
 (0)