acorn-io / runtime

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

Clean up non required compute class information output #2429

Closed keyallis closed 8 months ago

keyallis commented 8 months ago

Hide request scaler from output of compute classes. We also want to hide the scheduling fields from the app output if possible.

keyallis commented 8 months ago

Moving the hiding of scheduling out of the scope of this since it needs more ideation for the time being.

The changes should be verifiable by checking a compute class that is known to have a request scaler value set, and not seeing that value shown when doing a call to acorn offerings computeclass -o json. For example once the runtime version is bumped in manager main branch, any env in main should display that behavior. You should also be able to verify that the requested memory is being scaled down still since the scheduling information will still be shown on the apps.

cjellick commented 8 months ago

runtime bit of this is ready for qa. there's an outstanding pr to bump it in manager, but im moving this to qa for the purpose of testing v0.10.0

sangee2004 commented 8 months ago

acorn version - v0.0.0-dev+6ad41c01

Following error is seen when listing compute class

./acorn offering computeclass
  ✗  ERROR:  template: :1:39: executing "" at <memoryToRange .Memory>: error calling memoryToRange: object passed is not a ComputeClassMemory struct
sangee2004 commented 8 months ago

Tested with acorn version - v0.0.0-dev+7083bc6b

  1. Create a computeclass with requestScaler set
    apiVersion: admin.acorn.io/v1
    default: false
    metadata:
    name: cc2
    description: Large compute for linux on arm64
    cpuScaler: 0.75
    supportedRegions:
    - local
    memory:
    default: 20M
    values:
    - 10M
    - 20M
    - 30M
    requestScaler: 0.1
  2. Able to query for computeclass offerings
    ./acorn offering computeclass cc2        
    NAME      DEFAULT   MEMORY RANGE   MEMORY DEFAULT   REGIONS   DESCRIPTION
    cc2                 10M,20M,30M    20M              local     Large compute for linux on arm64
  3. Querying for computeclass offerings with "-o json" option does not expose the requestScaler setting
    ./acorn offering computeclass cc2 -o json               
    {
    "items": [
        {
            "metadata": {
                "name": "cc2",
                "creationTimestamp": null
            },
            "memory": {
                "default": "20M",
                "values": [
                    "10M",
                    "20M",
                    "30M"
                ]
            },
            "description": "Large compute for linux on arm64",
            "default": false,
            "supportedRegions": [
                "local"
            ]
        }
    ]
    }
  4. Deploying apps with is ComputeClass , has the requestScaler setting take effect as expected. From the scheduling section of the app:
                "scheduling": {
                    "mywebnew": {
                        "requirements": {
                            "limits": {
                                "memory": "20M"
                            },
                            "requests": {
                                "cpu": "2m",
                                "memory": "2M"
                            }
                        },
                        "tolerations": [
                            {
                                "key": "taints.acorn.io/workload",
                                "operator": "Exists"
                            }
                        ]
                    }
                },

From the pod definition:

                        "resources": {
                            "limits": {
                                "memory": "20M"
                            },
                            "requests": {
                                "cpu": "2m",
                                "memory": "2M"
                            }
                        },