0

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 Answers1

0

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

  • Hi Aditya, thanks for your response. But the HPA only consider metrics of a single object. My problem is, how can make it consider all existing objects and implement it in a right way. – Irvin Liang Apr 04 '22 at 03:20
  • I thought you are creating your own controller – achudiwal45 Apr 06 '22 at 14:55
  • Yes, I want to create a custom controller to reconcile all objects collaboratively instead of individually. – Irvin Liang Apr 07 '22 at 15:26