Skip to content

Commit

Permalink
build: Make golangci-lint logrlint happy.
Browse files Browse the repository at this point in the history
Fix "odd number of arguments passed as key-value pairs for logging".
Pass to logr key-value pairs for structured logging.

Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
  • Loading branch information
viccuad committed Oct 11, 2022
1 parent ccfe9ce commit 08ce746
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/policyserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
err := mgr.GetFieldIndexer().IndexField(context.Background(), &policiesv1.ClusterAdmissionPolicy{}, constants.PolicyServerIndexKey, func(object client.Object) []string {
policy, ok := object.(*policiesv1.ClusterAdmissionPolicy)
if !ok {
r.Log.Error(nil, "object is not type of ClusterAdmissionPolicy: %#v", policy)
r.Log.Error(nil, "object is not type of ClusterAdmissionPolicy: %#v", "policy", policy)
return []string{}
}
return []string{policy.Spec.PolicyServer}
Expand All @@ -136,7 +136,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
err = mgr.GetFieldIndexer().IndexField(context.Background(), &policiesv1.AdmissionPolicy{}, constants.PolicyServerIndexKey, func(object client.Object) []string {
policy, ok := object.(*policiesv1.AdmissionPolicy)
if !ok {
r.Log.Error(nil, "object is not type of ClusterAdmissionPolicy: %#v", policy)
r.Log.Error(nil, "object is not type of AdmissionPolicy: %#v", "policy", policy)
return []string{}
}
return []string{policy.Spec.PolicyServer}
Expand All @@ -153,7 +153,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
// object.
policy, ok := object.(*policiesv1.AdmissionPolicy)
if !ok {
r.Log.Info("object is not type of AdmissionPolicy: %+v", policy)
r.Log.Info("object is not type of AdmissionPolicy: %+v", "policy", policy)
return []ctrl.Request{}
}

Expand All @@ -172,7 +172,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
// object.
policy, ok := object.(*policiesv1.ClusterAdmissionPolicy)
if !ok {
r.Log.Info("object is not type of ClusterAdmissionPolicy: %+v", policy)
r.Log.Info("object is not type of ClusterAdmissionPolicy: %+v", "policy", policy)
return []ctrl.Request{}
}

Expand Down

0 comments on commit 08ce746

Please sign in to comment.