acorn-io / runtime

A simple application deployment framework built on Kubernetes
https://docs.acorn.io/
Apache License 2.0
1.14k stars 101 forks source link

Improve error message presented when computeclass creation fails because of memory being present in resources/limits. #2405

Open sangee2004 opened 6 months ago

sangee2004 commented 6 months ago

acorn version v0.10.0-rc2-9-g43dbcbf4+43dbcbf4

Steps to reproduce the problem:

  1. Try to create computeclass with memory present in resources/limits
    kind: ClusterComputeClass
    apiVersion: admin.acorn.io/v1
    default: false
    metadata:
    name: cc-res-inv
    description: Large compute for linux on arm64
    cpuScaler: 0.75
    supportedRegions:
    - local
    memory:
    default: 20M
    min: 10M
    max: 100M
    resources:
    limits:
    memory: 50M
    gpu-vendor.example/example-gpu: 2
    requests:
    gpu-vendor.example/example-gpu: 2
  2. This fails as expected with following error message:
    The ClusterComputeClass "cc-res-inv" is invalid: spec.resources.limits.memory: Invalid value: resource.Quantity{i:resource.int64Amount{value:50, scale:6}, d:resource.infDecAmount{Dec:(*inf.Dec)(nil)}, s:"50M", Format:"DecimalSI"}: Cannot specifiy spec.resources.limits.memory. Use explicit spec.cpuScaler and spec.memory instead

Expected Behavior: Error message can be improved to be more readable in this case.