kubermatic / dashboard

Dashboard For The Kubermatic Kubernetes Platform
https://www.kubermatic.com
Other
42 stars 62 forks source link

Test Live Quota - Release 2.22 #5584

Closed KhizerRehan closed 1 year ago

KhizerRehan commented 1 year ago

Testing Procedure user story

Testing live quota

Pre-Requisites:

How to configure quota for any project?

Live Quota General Testing:

Testing Live Quota

+ve Case

In case cluster exists already

*In case "new" cluster creating

quota-cration

Live quota for MD

Add MD (Details Page)

Edit MD Fix resource quota calculation for Edit MD (Details Page)

Live quota for Cluster Templates

Notes: for tester : Cluster Creation via Templates is allowed it won't prevent to create cluster even though if it exceeds

Acceptance Criteria

If quota is hit (at 100%) or overdrawn disable the following buttons a

Important note !!

Live quota doesn't cater Cluster Templates Dialog view as it requires backend changes since we only have clusterTemplateID and replica count in order to upgrade quota based on what compute size is defined in template should be figured by backend + No of Clusters.

However *Preventing creation of resources should work for

Allows option to "Save Template and Create" or "Save Template" so No widget is displayed

Allows option to save Template or create new one so No widget is displayed

Other Features

ahmadhamzh commented 1 year ago

in case create or edit or customize cluster template, i think we need to not block the user on the initial node step if the quota is exceeded, because the user might not want to create a cluster he might want just to create new cluster template so we need in case of quota exceeded to only disable the buttons for creating new cluster

so regarding wizard for cluster template we have three options, in all of them we need to let the user to go through all of the wizard steps:

1- create cluster template : save template and create cluster button will be disable || save cluster template button will stay enable

2- customize cluster template : save as new template button will stay enable || create cluster from customized template button will be disable

3- edit cluster template : save as new template & save changes to template buttons will stay enable

ahmadhamzh commented 1 year ago

so in the pic below im trying to increase the replica from 1 to 2 in the quota calculation that suppose to mean add one replica, but what happend is that in the quota it's show as im adding two replica ( i.e. the quota calculation is acting like im adding MD not Editing MD)

im not sure if it's related to backend or frontend @lsviben @KhizerRehan

image.png

image.png

lsviben commented 1 year ago

So, the API is stupid in this case, it just calculates based on the replicas given in the request. The amount of replicas in the request should be the amount of new replicas. So in this case, if 1 is already there, and you are adding 1 more, the request should have 1.

this is because the API just takes the current quota and adds what is in the request.

So @KhizerRehan , do you think you could handle this from the UI side?

KhizerRehan commented 1 year ago

in case create or edit or customize cluster template, i think we need to not block the user on the initial node step if the quota is exceeded, because the user might not want to create a cluster he might want just to create new cluster template so we need in case of quota exceeded to only disable the buttons for creating new cluster

so regarding wizard for cluster template we have three options, in all of them we need to let the user to go through all of the wizard steps:

1- create cluster template : save template and create cluster button will be disable || save cluster template button will stay enable

2- customize cluster template : save as new template button will stay enable || create cluster from customized template button will be disable

3- edit cluster template : save as new template & save changes to template buttons will stay enable

Agreed on this point

Ticket is created: Allow to save cluster template in edit and customize mode #5606

KhizerRehan commented 1 year ago

So, the API is stupid in this case, it just calculates based on the replicas given in the request. The amount of replicas in the request should be the amount of new replicas. So in this case, if 1 is already there, and you are adding 1 more, the request should have 1.

this is because the API just takes the current quota and adds what is in the request.

So @KhizerRehan , do you think you could handle this from the UI side?

As per discussion it was doable from UI side if only replica count was changed but on Edit case we have an option to change provider specific options e.g AWS -> Node Size can be changed.

So basically, changing Node Size + Replica Count BOTH from dialog backend should have to do Recalculation and returns new estimated quota.

We can't just decrease replica count by HOW many times it is changed from Prev to New value the estimation calculation will be wrong IMHO as what i have understood. So therefore it will be fixed from backend.

KhizerRehan commented 1 year ago

Hi, @ahmadhamzh description of ticket is slightly updated specifically for Live quota for MD heading you need to test for (Add/Edit) MD there is slightly technically difference from code POV but as the tester for this ticket functionality should work and please test this Add/Edit for random providers e.g

Waseem826 commented 1 year ago

Quota calculation API for KubeVirt returns following error in Edit MD dialog:

{
    "code": 400,
    "message": "invalid request, failed getting resources from request body: failed to parse kubevirt node storage \"10GiG\" to resource quantity: unable to parse quantity's suffix"
}

Payload:

{
    "replicas": 1,
    "kubevirtNodeSize": {
        "primaryDiskSize": "10G",
        "cpus": "2",
        "memory": "2048M"
    },
    "replacedResources": {
        "replicas": 1,
        "kubevirtNodeSize": {
            "primaryDiskSize": "10GiG",
            "cpus": "2",
            "memory": "2048M"
        }
    }
}
ahmadhamzh commented 1 year ago

in azure i think something wrong with the node size that effect the quota to be exceeded this is the sizes come from backend : Screenshot from 2023-02-08 09-35-53.png

and this is the payload from quota calculation : image.png so the issue is with osDiskSizeInMB im not sure do we need to send it in the payload and i think the value that come from backend is wrong

@KhizerRehan im not sure who to reach for the backend issue

KhizerRehan commented 1 year ago

@ahmadhamzh you can ask @pkprzekwas for this thing just make sure UI is passing correct payload which i guess it is as Node size is returning from backend and we just filter from dropdown and pass to backend for quota calculation

KhizerRehan commented 1 year ago

Quota calculation API for KubeVirt returns following error in Edit MD dialog:

{
    "code": 400,
    "message": "invalid request, failed getting resources from request body: failed to parse kubevirt node storage \"10GiG\" to resource quantity: unable to parse quantity's suffix"
}

Payload:

{
    "replicas": 1,
    "kubevirtNodeSize": {
        "primaryDiskSize": "10G",
        "cpus": "2",
        "memory": "2048M"
    },
    "replacedResources": {
        "replicas": 1,
        "kubevirtNodeSize": {
            "primaryDiskSize": "10GiG",
            "cpus": "2",
            "memory": "2048M"
        }
    }
}

Strange i can check it again if it's issue from UI side because i think parsing due to GiG is causing the issue.

pkprzekwas commented 1 year ago

in azure i think something wrong with the node size that effect the quota to be exceeded this is the sizes come from backend : Screenshot from 2023-02-08 09-35-53.png

and this is the payload from quota calculation : image.png so the issue is with osDiskSizeInMB im not sure do we need to send it in the payload and i think the value that come from backend is wrong

@KhizerRehan im not sure who to reach for the backend issue

Looks like values that are sent to the resource calculation endpoint are defaults from the listing VMs endpoint. Instead, we should replace them with values that user puts in OS Disk Size and Data Disk size form fields before sending calculation request.

Screenshot below proofs that those are values that are actually being sent at the time of creation:

Screenshot 2023-02-08 at 14 31 39
ahmadhamzh commented 1 year ago

all seems good

Waseem826 commented 1 year ago

I noticed that if we save KubeVirt cluster template which has Instance Type and Preference values, then editing/customizing that template causes following API error for quota calculation:

{
    "code": 400,
    "message": "invalid request, failed getting resources from request body: error converting kubevirt node size cpus \"undefined\" to int: strconv.Atoi: parsing \"undefined\": invalid syntax"
}

Request payload:

{
    "replicas": 1,
    "kubevirtNodeSize": {
        "primaryDiskSize": "20",
        "cpus": "undefined"
    }
}
ahmadhamzh commented 1 year ago

all seems good there is only one issue will be fixed in : https://github.com/kubermatic/dashboard/pull/5751