[Feature] use kubernetes events to trigger autoscaling vs directly patching the CR
Search before asking
- [X] I had searched in the issues and found no similar feature requirement.
Description
Per this discussion on ray cluster running on k9s here, currently autoscaler calls out the ray cluster CR and patches the CR to increase/decrease the number of replicas.
a possible issue with this approach is that there is no visibility in k8s that the CR spec has been changed. we can still get visibility from the autoscaler that scaling has happened, but from a k8s perspective there is no traceability.
an alternative approach might be to leverage k8s events, and rather than directly patching the CR to change the number of replicas, we can trigger off a k8s event that can then change the replicas. the advantage of this approach being that there is a k8s native visibility into an autoscaling event.
one possible drawback in this flow is that the controller will be both responsible for capturing the event that autoscaling needs to be applied, as well as changing the CR spec, which I am not sure is the best thing to do. with the current setup, the autoscaler is the one that is changing the spec, and that is happening outside the controller logic. the controller is simply responsible for reconciling. but with this new suggested approach the controller is responsible for both listening to the event and changing the CR and then reconciling.
Use case
No response
Related issues
No response
Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!