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.