kyma-project / busola

Web based Kubernetes Dashboard with a focus on privacy that requires no active components or special privileges in your cluster.
Apache License 2.0
24 stars 47 forks source link

BUG: Memory requests and Limits graphs should not sum values from Resource Quotas but take the lower one #2988

Closed akucharska closed 2 months ago

akucharska commented 2 months ago

If there is more than one resource quota on a namespace then the lower value should be used in graphs

Image

dbadura commented 2 months ago

Taking the lowest resource

Having 2 Resource Quotas:

apiVersion: v1
kind: ResourceQuota
metadata:
  name: pods-high
spec:
  hard:
    cpu: "1000"
    memory: 2Gi
    pods: "10"
  scopeSelector:
    matchExpressions:
    - operator : In
      scopeName: PriorityClass
      values: ["high"]
apiVersion: v1
kind: ResourceQuota
metadata:
  name: pods-low
spec:
  hard:
    cpu: "1000"
    memory: 2Gi
    pods: "10"
  scopeSelector:
    matchExpressions:
    - operator : In
      scopeName: PriorityClass
      values: ["low"]

and applying such pod:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: test-container
  name: test-container
spec:
  priorityClassName: low
  containers:
  - name: test-container
    image: nginx
    resources:
      requests:
        cpu: 100m
        memory: 100Mi
      limits:
        cpu: 500m
        memory: 1Gi

Will trigger only one quota:

→ kubectl get quota
NAME                  AGE   REQUEST                                       LIMIT
pods-high-burstable   21s   cpu: 0/1k, memory: 0/2Gi, pods: 0/10          
pods-low-burstable    38s   cpu: 100m/1k, memory: 100Mi/2Gi, pods: 1/10 

It doesn't make sense to get mnimum value from resource quota.

Taking the sum of resources

The same situation applies to sum of resources: https://stackoverflow.com/questions/69127848/what-happens-if-more-than-one-resourcequota-is-enabled-per-namespace.

dbadura commented 2 months ago

Possible solution

We could try to group quotas by selectors and find the lowest values within the same group.

dbadura commented 2 months ago

Closed in favor: https://github.com/kyma-project/busola/issues/2992