Skip to content
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

Provide support for preventing interference of autoscaling a single scale target with arbitrary HPAs #3087

Closed
tomkerkhove opened this issue May 31, 2022 · 14 comments · Fixed by kedacore/charts#352
Labels
feature All issues for new features that have been committed to prevention

Comments

@tomkerkhove
Copy link
Member

Proposal

If somebody creates an HPA while it is already being autoscaled by an ScaledJob/ScaledObject, we should prevent the HPA from being created by using an admission controller that rejects the HPA.

Alternatively, KEDA can just log a warning so that end-users become aware of it but this does not reject HPA resources and might get lost.

Use-Case

Prevent end-users from having multiple actors scale workloads, either by accident or on purpose, to prevent flapping due to different criteria.

In this scenario, we want to prevent end-users creating arbitrary HPAs when a scale target is already scaled by a ScaledObject/ScaledJob.

Anything else?

No response

@tomkerkhove tomkerkhove added the feature All issues for new features that have been committed to label May 31, 2022
@tomkerkhove tomkerkhove moved this to Proposed in Roadmap - KEDA Core May 31, 2022
@tomkerkhove tomkerkhove moved this from Proposed to To Do in Roadmap - KEDA Core May 31, 2022
@bamboo12366
Copy link
Contributor

I urgently need this one, if no one is working on this can I give a try?

@tomkerkhove
Copy link
Member Author

That would be nice! But we need to close on the approach first, certainly if we introduce an admission controller we need to see where we will shove it in (core or separate).

Thoughts @kedacore/keda-maintainers?

@JorTurFer
Copy link
Member

It's a really good idea IMO. Maybe not only for preventing HPA in case of already existing SO and also for preventing SO if there is already a HPA or another SO.

From technical pov, I have never implemented something like this, so I can't say anything, but I'm interested on how to do it

@tomkerkhove
Copy link
Member Author

It's a really good idea IMO. Maybe not only for preventing HPA in case of already existing SO and also for preventing SO if there is already a HPA or another SO.

Already got you covered with #3083 ;)

@bamboo12366
Copy link
Contributor

bamboo12366 commented Jun 1, 2022

But I think this two can be covered by checking hpa and workload(i.e: deployment or statefulset) binding

Just check is there existing binding when new request for creating hpa no matter manually or scaleObject create:

  • if manually, just report error in client side. User using kubectl or client-go will notice that
  • if created by scaleObject, we can log this at scaleObject condition

Do I miss something or not correct?

@tomkerkhove
Copy link
Member Author

If you create an HPA manually and deploy it, there is no way for KEDA to stop it except without using an admission controller since KEDA doesn't manage the HPAs but Kubernetes vanilla does.

@bamboo12366
Copy link
Contributor

If you create an HPA manually and deploy it, there is no way for KEDA to stop it except without using an admission controller since KEDA doesn't manage the HPAs but Kubernetes vanilla does.

True, I mean by implement by using admission controller(which is part of keda components). The stop process is away from keda main logic.

@tomkerkhove
Copy link
Member Author

Yes, but preferrably a SO/SJ is blocked from being created even instead of having a status

@zroubalik
Copy link
Member

Admission controllers are always tricky. If we fallback to just reporting this in SO status and emitting events, then I am fine with it.

@zroubalik
Copy link
Member

zroubalik commented Jun 1, 2022

We would need a separate controller for watching HPAs in the cluster.

So I am inclined to make this optional.

@tomkerkhove
Copy link
Member Author

This should definately be optional and configurable through config on operator.

Admission controllers are always tricky. If we fallback to just reporting this in SO status and emitting events, then I am fine with it.

How would you do that without an admission controller for this HPA scenario then? For SO we can do it but why put an SO in failed if you can prevent it from being created already? (either in operator or admission controller)

@zroubalik
Copy link
Member

I mean to keep just the SO Status as the base feature and an option to fallback to for people which don't want to (or can't) use admission webhooks.

@bamboo12366
Copy link
Contributor

For the base feature one, in the scaleObejct Controller main logic just to check no other hpa existing in the cluster binding with workload, if exist reporting in status and emit an event right?

@zroubalik
Copy link
Member

Yeah, but please make it configurable, so it is not enabled by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature All issues for new features that have been committed to prevention
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants