-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 memory leak by checking triggers uniqueness properly #1640
Conversation
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Might be better to move the uniqueness check
similiar check moved to hpa getScaledObjectMetricSpecs Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, just minor typo in err message
controllers/hpa.go
Outdated
if metricSpec.External != nil { | ||
externalMetricName := metricSpec.External.Metric.Name | ||
if util.Contains(externalMetricNames, externalMetricName) { | ||
return nil, fmt.Errorf("metricName %s defined multiple times in ScaledObject %s, please refer the documentation how to define metircName manually", externalMetricName, scaledObject.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("metricName %s defined multiple times in ScaledObject %s, please refer the documentation how to define metircName manually", externalMetricName, scaledObject.Name) | |
return nil, fmt.Errorf("metricName %s defined multiple times in ScaledObject %s, please refer the documentation how to define metricName manually", externalMetricName, scaledObject.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! Thank you!
controllers/hpa.go
Outdated
@@ -15,6 +15,7 @@ import ( | |||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | |||
|
|||
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1" | |||
"github.com/kedacore/keda/v2/controllers/util" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same is imported on the line below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awkward. Fixed! :D
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
I'm running pre-commit now locally. It looks like a formating change needs to be done |
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
CHANGELOG.md
Outdated
@@ -31,6 +31,7 @@ | |||
- Fix a memory leak in kafka client and close push scalers ([#1565](https://github.com/kedacore/keda/issues/1565)) | |||
- Add 'Metadata' header to AAD podIdentity request ([#1566](https://github.com/kedacore/keda/issues/1566)) | |||
- KEDA should make sure generate correct labels for HPA ([#1630](https://github.com/kedacore/keda/issues/1630)) | |||
- Close scalers after name check; fix memory leak ([#1636](https://github.com/kedacore/keda/issues/1636)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Close scalers after name check; fix memory leak ([#1636](https://github.com/kedacore/keda/issues/1636)) | |
- Fix memory leak by checking triggers uniqueness properly ([#1640](https://github.com/kedacore/keda/pull/1640)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed! Good suggestion
Signed-off-by: ycabrer <43866176+ycabrer@users.noreply.github.com>
@zroubalik How do I retrigger a check? It looks like the FOSSA check timed out. |
@ycabrer I did that :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Provide a description of what has been changed
Checklist
Fixes #
Potential fix for #1636
Scalers were not being closed properly after use.