banzaicloud / telescopes

Telescopes is a cloud instance types and full cluster layout recommender consisting of on-demand and spot/preemptible AWS EC2, Google, Azure, Oracle and Alibaba cloud instances.
Apache License 2.0
163 stars 19 forks source link

Inconsistent error messages in case if recommendation is not possible #173

Open sancyx opened 5 years ago

sancyx commented 5 years ago

If you invoke scaleOut with the below payload, which is the exact cluster layout returned by recommendation call for same resource number, you get an error 400 (could not recommend cluster with the requested resources). However if you set "sumNodes": 1 for t3.medium spot pool you will get error 500 (error: &errors.errorString{s:\"there's already enough resources in the cluster. Total resources available: CPU: 4, Mem: 8\"}). In case you decrease desiredMem = 3 you'll get the same layout recommendation. It would desirable to have same behaviour in each case, either return the same clusterLayout or return the same error code and message, since in each case you have enough resources in your cluster.


{
    "desiredCpu":2,
    "desiredMem":4,
    "desiredGpu":0,
    "onDemandPct":80,
    "actualLayout": [
        {
          "instanceType": "t3.medium",
          "vmClass": "regular",
          "sumNodes": 1
        },
        {
          "instanceType": "t3.medium",
          "vmClass": "spot",
          "sumNodes": 0
        },
        {
          "instanceType": "t2.small",
          "vmClass": "spot",
          "sumNodes": 0
        },
        {
          "instanceType": "t2.medium",
          "vmClass": "spot",
          "sumNodes": 0
        },
        {
          "instanceType": "t2.large",
          "vmClass": "spot",
          "sumNodes": 0
        },
        {
          "instanceType": "t3.large",
          "vmClass": "spot",
          "sumNodes": 0
        },
        {
          "instanceType": "m4.large",
          "vmClass": "spot",
          "sumNodes": 0
        }
    ]
}```
waynz0r commented 5 years ago

I would not treat there's already enough resources in the cluster as an error.