-
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
Introduce minReplicaCount for scaledjob #3425
Conversation
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
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 for the PR, before I am gonna do a full review, could you please adress these points:
- open an issue describing the feature and link it in the Changelog
- Add tests, there are some SJ related unit tests and adding and e2e tests would be great as well (we are migrating these to Go atm) - https://github.com/kedacore/keda/tree/main/tests
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
Hi @zroubalik, I've incorporated your requests. Please have a look. |
Signed-off-by: Simon Oehm <[email protected]>
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,
some nits inline
@@ -111,8 +113,19 @@ func init() { | |||
// MaxReplicaCount returns MaxReplicaCount | |||
func (s ScaledJob) MaxReplicaCount() int64 { | |||
if s.Spec.MaxReplicaCount != nil { | |||
return int64(*s.Spec.MaxReplicaCount) | |||
return int64(*s.Spec.MaxReplicaCount) - s.MinReplicaCount() |
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.
Why do we need this? Does MaxReplicaCount change based on MinReplicaCount?
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.
Without - s.MinReplicaCount()
Keda would scale potentially to maxReplicaCount + minReplicaCount amount of jobs because the actual scaling logic/ scaling strategy knows nothing about the minReplica scaling. This can be seen greatly when removing - s.MinReplicaCount()
and running the e2e test. Keda will scale > maxReplicaCount.
/run-e2e external* |
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
Signed-off-by: Simon Oehm <[email protected]>
} | ||
|
||
return isTargetAchieved | ||
} |
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've added this function to ensure that no overscaling happens. The waitForJobCount function above in the file returns the result immediately as soon as count == target
. This function waits for all iterations before returning the final result.
/run-e2e min_replica* |
/run-e2e min_replica* |
This will not work, only organization members can run the e2e tests. I have triggered them again, now with the correct regex 😄 |
Signed-off-by: Zbynek Roubalik <[email protected]>
Signed-off-by: Simon Oehm [email protected]
Provide a description of what has been changed
This PR introduces a property called minReplicaCount. The purpose of this property is to specify a job amount that should be created by default. The feature is useful if you want to avoid pod startup times and can be used in combination with "custom" strategy and "customScalingQueueLengthDeduction" property.
Without "minReplicaCount" only the following scaling can be achieved:
With "minReplicaCount" we can achieve the following result:
Checklist
Fixes #
Relates to #3426
Documentation: kedacore/keda-docs#836