Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Simple way to know HierarchicalResourceQuota status #274

Closed
@mochizuki875

Description

@mochizuki875

Overview

When using HierarchicalResourceQuota, resource quotas is applied across parent and child Namespaces.
However, there is no way to know the quota and consumption of resource in the HierarchicalResourceQuota other than check the detail.
This may confuse users, so I think there should be a simple way to know it(like kubectl get resourcequotas).

Detail

For example, there are two Namespaces with hierarchy like this.
If HierarchicalResourceQuota of limits.cpu=1 is applied to the parent test Namespace, the total amount of CPU available across parent and child Namespaces is 1.

test
└── subns-a

Now, the result of kubectl get hierarchicalresourcequotas is this.
We can't know the quota and consumption of resource.

$ kubectl get hierarchicalresourcequotas -n test
NAME       AGE
test-hrq   80s

To know that, we need to check the detail of HierarchicalResourceQuota.
In this case, the total CPU concumption across parent and child Namespace is 500m/1.

$ kubectl describe hierarchicalresourcequotas test-hrq -n test
Name:         test-hrq
Namespace:    test
Labels:       <none>
Annotations:  <none>
API Version:  hnc.x-k8s.io/v1alpha2
Kind:         HierarchicalResourceQuota
...
Spec:
  Hard:
    limits.cpu:  1
Status:
  Hard:
    limits.cpu:  1
  Used:
    limits.cpu:  500m
Events:          <none>

In addition, if we check the ResourceQuota of each Namespace that are automatically created in each Namespace when we create HierarchicalResourceQuota, the result is this.

$ kubectl get resourcequotas -n test
NAME               AGE   REQUEST   LIMIT
hrq.hnc.x-k8s.io   16s             limits.cpu: 500m/1

$ kubectl get resourcequotas -n subns-a 
NAME               AGE   REQUEST   LIMIT
hrq.hnc.x-k8s.io   19s             limits.cpu: 0/1

These status do not fully reflect quotas by HierarchicalResourceQuota.
In this case, it looks like this:

  • test Namespace: 500m remaining CPU available
  • subns-a Namespace: 1 CPU available

However, the actual available CPU is 500m across these Namespaces.

Expectation

I think there should be a simple way to know HierarchicalResourceQuota status like this.

NAME               AGE   REQUEST   LIMIT
test-hrq           50s             limits.cpu: 500m/1

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions