-
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
support cpu/memory scaler #1215
Conversation
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.
Could you please add tests for this scaler? (unit tests for sure and e2d would be nice to have)
886a3b5
to
b7447cf
Compare
PTAL @zroubalik |
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.
minor nits
9a9bd62
to
a226901
Compare
@@ -254,7 +264,9 @@ func (h *scaleHandler) checkScaledJobScalers(ctx context.Context, scalers []scal | |||
scalerLogger.Info("Scaler is active") | |||
} | |||
} | |||
maxValue = min(scaledJob.MaxReplicaCount(), devideWithCeil(queueLength, targetAverageValue)) | |||
if targetAverageValue != 0 { |
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.
@TsuyoshiUshio could you please check, that this is ok?
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.
I added this judgment to avoid that if only the cpu/memory scaler is used in the ScalerJobs, the targetAverageValue is 0 (of course this is meaningless), which causes the devideWithCeil method to panic
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.
Hi @zroubalik @silenceper
It looks good to me. TargetAverageValue is should be bigger than 1. In case of 0, that means no scale. So that This logic is correct. Thank you for adding the condition!
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.
Thanks @TsuyoshiUshio!
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
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.
I approve, LGTM. However Can I clarify one thing? @silenceper
According to the code, the usage of cpu/memory scaler is for HPA only, right? Not for ScaledJob. I mean you add resourcemetricNames on ScaledOjbect only. If so we might consider documentation for it. Thank you for your contribution.
@TsuyoshiUshio |
Signed-off-by: silenceper <silenceper@gmail.com>
Signed-off-by: silenceper <silenceper@gmail.com>
Signed-off-by: silenceper <silenceper@gmail.com>
Signed-off-by: silenceper <silenceper@gmail.com>
Signed-off-by: silenceper <silenceper@gmail.com>
Signed-off-by: silenceper <silenceper@gmail.com>
Signed-off-by: silenceper <silenceper@gmail.com>
a226901
to
d8add4b
Compare
Looks like we are good to go, right @zroubalik @TsuyoshiUshio ? |
@silenceper thanks for the contribution! |
Signed-off-by: silenceper silenceper@gmail.com
horizontalPodAutoscalerConfig.resourceMetrics
Checklist
Fixes #1183