-
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
Continuous update of HPA objects #1531
Comments
Thanks a lot @surki for the detailed analysis! Agree, the current behavior is not good :( To fix this, we can probably append the Resources metrics always at the end of the generated metrics list, in here: Line 135 in 1b913f1
|
hmm, we don't support other HPA resource types? wondering if should we do something like this diff --git a/controllers/hpa.go b/controllers/hpa.go
index 3354889..beaf570 100644
--- a/controllers/hpa.go
+++ b/controllers/hpa.go
@@ -3,6 +3,7 @@ package controllers
import (
"context"
"fmt"
+ "sort"
"github.com/go-logr/logr"
version "github.com/kedacore/keda/v2/version"
@@ -161,6 +162,10 @@ func (r *ScaledObjectReconciler) getScaledObjectMetricSpecs(logger logr.Logger,
scaler.Close()
}
+ sort.Slice(scaledObjectMetricSpecs, func(i, j int) bool {
+ return scaledObjectMetricSpecs[i].Type < scaledObjectMetricSpecs[j].Type
+ })
+
// store External.MetricNames,Resource.MetricsNames used by scalers defined in the ScaledObject
status := scaledObject.Status.DeepCopy()
status.ExternalMetricNames = externalMetricNames |
@surki in KEDA we are using Would you mind sending a PR for this? |
@surki we plan to release KEDA 2.1 tomorrow, so please let me know if you are willing to send a PR with this, if not, I'll do that :) |
I might not be able to get to this by tomorrow, can you please fix this?
…On Tue, Jan 26, 2021 at 8:02 PM Zbynek Roubalik ***@***.***> wrote:
@surki <https://github.com/surki> we plan to release KEDA 2.1 tomorrow,
so please let me know if you are willing to send a PR with this, if not,
I'll do that :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1531 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAL3BHZPIWAC3KNFLJ2J6DS33G7JANCNFSM4WRSJODA>
.
|
@surki no worries, thanks for the heads up! |
Even when there are no changes to ScaledObject or HPA, keda-operator continuously updates the HPA after it "finds" the current HPA that's in apiserver and the new HPA that is computed from ScaledObject (in here). We have hundreds of ScaledObjects. leading to too many unnecessary updates to api server.
Enabled debug logs, the difference seems to boil down to the order of metrics listed in the
metrics
array (probablyequality.Semantic.DeepDerivative
expects slices to be in same order?)(note that
Resource
types comes first in new whereas theResource
type comes last in the current. If we rearrange it in the ScaledObject YAML, the issue gets resolved, see steps in Steps to Reproduce the Problem )Expected Behavior
No unncessary updates
Actual Behavior
Unnecessary updates
Steps to Reproduce the Problem
Updated HPA according to ScaledObject
Logs from KEDA operator
Specifications
The text was updated successfully, but these errors were encountered: