-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat: Move http scaled object from single host to multi host system #674
Conversation
@JorTurFer Hey, as stated in #585 here is the PR continuing the work on multi hosts after the rebase :) |
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 but I have one question about the expected behavior.
This approach will create a ScaledObject with one external trigger, but in the HPA side we will have multiple metrics (one per host), so we won't scale based on the sum of all the hosts, we will scale based on max(hosts).
If we want to scale based on the sum of all of them, we should return just a single metric spec in GetMetricSpec
and sum all the host values in a single metric result from GetMetrics
(in scaler/handlers.go).
IMO, scaling based on the sum of all of them makes sense but I don't have any strong opinion about this, maybe we can choose one option and iterate over it in the future
b198fd8
to
bd9cefe
Compare
@JorTurFer Good idea! I agree with you I think it makes more sense to scale based on the sum of all requests. I've updated my PR to integrate this change and added a unit test for this scenario. I've added this change in a separate commit to make it easier to review this new change on your end but feel free to squash it all together when merging. I've also ran |
d671f7f
to
88c04f4
Compare
Hopefully this one is the one :) |
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 last nits about the code to avoid some variables 😄
Apart from them, could you update the changelog to add these changes? (In the breaking change version)
Once these things are done, we can merge the PR 🥳 🥳 🥳
88c04f4
to
0a44951
Compare
Changelog has been updated :) |
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 for this awesome improvement
@tomkerkhove , could you take a look?
0a44951
to
2ec499d
Compare
Are we allowing breaking changes without bumping the API Version? This will break every HTTPScaledObject on the cluster when you update the add-on. I was about to propose a new
|
I thought that we are fine with the breaking changes until v1.0: #585 (comment) |
I see that a bit differently. I agree we can remove features, change behaviours, and don't commit to anything before v1.0.0, but I think we should always have an upgrade path available for the current users of the service. Otherwise, we are telling people not to use this in any way before we have a stable version. People using non-stable software expect that there may be bugs and that everything can change anytime. But if we don't give them an upgrade option, even users comfortable with the nuances of beta software would stop using the add-on other than to play around with it. Fewer people using the add-on also means fewer contributors and less feedback, making it harder to continue development. For example, Argo Rollouts and Terraform are two softwares we used at Microsoft even before their 1.0.0 versions. There were problems, and things changed abruptly, but we could rely on the fact that there would always be a way to move forward. If there wasn’t, we wouldn't have used them. |
I prefer to not introduce breaking changes neither, but based on the comment I understood that it wasn't a problem. Maybe we can support both (host and hosts):
|
Yeah, that sounds perfect. I totally agree with that implementation. |
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.
Lets address the proposal without the breaking change as @t0rr3sp3dr0 suggested
Signed-off-by: Somesh Koli <somesh.koli@headout.com> Signed-off-by: Jocelyn Thode <jocelyn@thode.email>
Signed-off-by: Jocelyn Thode <jocelyn@thode.email>
2ec499d
to
aa49f6e
Compare
Hey @JorTurFer and @t0rr3sp3dr0, I've added a commit to instead deprecate the Unfortunately as there are currently no differentiation between Info logs that I could see I could not make the deprecation warning stand out more. Let me know if I missed something. I've added a few unit tests to make sure it's doing what we want and I've tested my feature with the e2e Suite. Here are the results: Specifying both It errors out as expected and the routing table stays empty.
Specifying only The
Specifying only Works as before this last change. Let me know if that's ok :) |
Used https://github.com/kedacore/keda/blob/main/CHANGELOG.md as the inspiration to fix the Changelog for the deprecation :) |
I think now it better, WDTY @t0rr3sp3dr0 ? |
Overall, the patch LGTM. I suggested just a tiny change. |
4f2d172
to
1b8efa3
Compare
Thanks a lot ❤️ |
@JorTurFer @t0rr3sp3dr0: The static checks are failing due to my If-Else chain in the Could you please advise me on how I could disable this check for this function or if you want me to rewrite it as a switch statement how would you like it to be rewritten? Feel free to directly commit a fix to the branch if you have one, so that we can finally merge this PR :) |
The problem is that you have an else block after an if statement that always returns. Remove all the redundant else’s from the code and the check should pass. You should hardly use else blocks in Go if you follow the patterns of the language. If you are using them, it’s likely that some refactoring is able to get rid of these blocks. |
Head branch was pushed to by a user without write access
528e34d
to
055a7ed
Compare
Signed-off-by: Jocelyn Thode <jocelyn@thode.email>
055a7ed
to
aadba5a
Compare
@t0rr3sp3dr0: Thanks for the pointers I think I've fixed the issue :) |
@JorTurFer: Could you restart the process again please to see if this time it goes through? |
thanks for the contribution! ❤️ |
@JorTurFer Yay finally! All tests are green. Happy to have contributed :) This is a feature that we need in my company as we're currently trying to rollout a scale to zero on all our dev/staging environments :) Thank you both for your patience! |
Happy to see this wrap 🚀 thanks @jocelynthode for helping with rebase and updates |
…system (kedacore#674)" This reverts commit e0e9596.
Recreate #585 as the rebasing moved the host field to triggers which only accepts
map[string]string
in metadata and thus we could not continue using a list of hosts.The approach chosen is that when creating the
ScaledObject
we concatenate theHTTPScaledObject
host list to a comma separated string.e2e-tests have been ran locally as well as testing that both hosts scale the correct container.
Here is an excerpt of the configmap generated:
Checklist
README.md
docs/
directorycc @someshkoli
Fixes #552