CPU pre-flights on auto-scaling clusters

I’ve got a pre-flight defined in my kots-preflight.yaml that checks the number of cores available in a cluster.

    - nodeResources:
        checkName: Total CPU Cores
        outcomes:
          - fail:
              when: "sum(cpuCapacity) < 10"
              message: The cluster does not contain enough cores to run the app.
          - warn:
              when: "sum(cpuCapacity) < 14"
              message: The cluster can run the app, but may run into CPU allocation issues.
          - pass:
              message: The cluster contains the recommended number of cores.

The check appears to be based on the number of cores currently provisioned, and is failing frequently on auto-scaling clusters that have the ability to scale into the “pass” range. I would like for the test to pass in these scenarios. Is there any way to base this check on the cluster’s scaled-up limit instead of the currently-available core count?

1 Like

Great question @anyweez!
I think this isn’t currently possible with the nodeResources analyzer. I think it might also depend on what you use for the Cluster Auto Scaler. For example if you use the k8s Cluster Autoscaler, there’s an argument max-nodes-total in the faq. So maybe one way of doing this would be to use the run-pod to get to the max-nodes-total value?
I’m not sure if that value is maybe exposed via a svc or configmap.

Has there been any more thought or updates here? We are now thinking about the intersection of various autoscale methods and preflight checks.

Hey, Mitch. AFAIK this hasn’t changed yet. If it’s something that significant for you, feel free to open a feature request so we can track it internally and see if it’s something the team has considered.

Autoscaling has come up a few times recently with other customers. So I don’t know that this is something that will get implemented soon, but it’s good to see greater interest in it as well.