Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix odd number of arguments passed as key-value pairs for logging #4369

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
### Other

- **General**: Drop a transitive dependency on bou.ke/monkey ([#4364](https://github.com/kedacore/keda/issues/4364))
- **General**: Fix odd number of arguments passed as key-value pairs for logging ([#4368](https://github.com/kedacore/keda/issues/4368))

## v2.10.0

Expand Down
8 changes: 4 additions & 4 deletions controllers/keda/scaledobject_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (r *ScaledObjectReconciler) reconcileScaledObject(ctx context.Context, logg
return "ScaledObject doesn't have correct Idle/Min/Max Replica Counts specification", err
}

err = r.checkTriggers(scaledObject)
err = r.checkTriggers(logger, scaledObject)
if err != nil {
return "ScaledObject doesn't have correct triggers specification", err
}
Expand Down Expand Up @@ -337,7 +337,7 @@ func (r *ScaledObjectReconciler) checkTargetResourceIsScalable(ctx context.Conte
// checkTriggers checks that general trigger metadata are valid, it checks:
// - triggerNames in ScaledObject are unique
// - useCachedMetrics is defined only for a supported triggers
func (r *ScaledObjectReconciler) checkTriggers(scaledObject *kedav1alpha1.ScaledObject) error {
func (r *ScaledObjectReconciler) checkTriggers(logger logr.Logger, scaledObject *kedav1alpha1.ScaledObject) error {
triggersCount := len(scaledObject.Spec.Triggers)

if triggersCount > 1 {
Expand All @@ -355,14 +355,14 @@ func (r *ScaledObjectReconciler) checkTriggers(scaledObject *kedav1alpha1.Scaled
_, hasMetricName := trigger.Metadata["metricName"]
// aws-cloudwatch and huawei-cloudeye have a meaningful use of metricName
if hasMetricName && trigger.Type != "aws-cloudwatch" && trigger.Type != "huawei-cloudeye" {
log.Log.Info("metricName is deprecated and will be removed in v2.12, please do not set it anymore (used in %q)", trigger.Type)
logger.Info("\"metricName\" is deprecated and will be removed in v2.12, please do not set it anymore", "trigger.type", trigger.Type)
}

name := trigger.Name
if name != "" {
if _, found := triggerNames[name]; found {
// found duplicate name
return fmt.Errorf("triggerName=%s is defined multiple times in the ScaledObject, but it must be unique", name)
return fmt.Errorf("triggerName %q is defined multiple times in the ScaledObject, but it must be unique", name)
}
triggerNames[name] = true
}
Expand Down