Open kelvien-microsoft opened 7 months ago
I think this is a good idea
Agree, I like this.
@SpiritZhou is this something you want to your list of things to work on?
I can work on this.
Currently, the validation in webhook compares the scaleTargetRef.Name directly from two ScaledObjects instead of listing the scaling target first. Adding a field-selector in scaleTargetRef is not effective. Maybe supporting a field-selector in ScaledObject will be better? WDYT @zroubalik
@SpiritZhou I don't have objections, would it solve the original request though?
Proposal
Field selector is used in K8s to filter out objects based on the resource fields. I'm proposing that we support a field selector on the Scaled object's .spec.scaleTargetRef.name so that we can find scaled object's with the specified scale target easily and quicker.
There is a validation on the backend to ensure that scaled object is not created on top of an existing deployment that has been targeted by existing scaled object.
Error from server (Forbidden): error when creating "so.yaml": admission webhook "vscaledobject.kb.io" denied the request: the workload 'test' of type 'apps/v1.Deployment' is already managed by the ScaledObject 'test-so'
I think we can use the same logic in that validation to return the scaled object that fits into the filtering criteria.Use-Case
As the number of scaled objects and deployment grows, it is hard to keep track of which deployments have a scaler. And having this field-selector allows us to quickly find out if a deployment is valid to be scaled out or not.
Is this a feature you are interested in implementing yourself?
No
Anything else?
No response