Kubernetes customized controller for collaborated auto scaling

167 views Asked by At

I am very new to Kubernetes CRD and customized controller. I am trying to implement a customized controller that horizontally scale my CRD instances in a collaborated way. For example, suppose I have 5 CPUs and two Jobs. Each of them has 2 replicas and each replica run on one CPU:

Jobs    Replicas    CPU
------------------------
Alice   2           2
Bob     2           2    

Now, assume some events happen and both Jobs decide to scale to 3 replicas. But since I have only 5 CPUs, only one Job can scale up. So my question is, how can I implement my logic in the controller so that the Jobs can agree who should take the resources?

I just read through the kubebuilder tutorial. The examples only show how to scale Jobs independently. It's not clear to me how can I resolve the resource conflict situation in a collaborated way.

1

There are 1 answers

3
achudiwal45 On

For this , you can add a new parameter for jobs i.e priority and on the basis of that you can resolve resource conflict.