mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-28 13:45:50 +00:00
Eliminate ResourceQuotaUsage in favor of ResourceQuota status
This commit is contained in:
@@ -114,11 +114,13 @@ func (rm *ResourceQuotaManager) syncResourceQuota(quota api.ResourceQuota) (err
|
||||
dirty := quota.Status.Hard == nil || quota.Status.Used == nil
|
||||
|
||||
// Create a usage object that is based on the quota resource version
|
||||
usage := api.ResourceQuotaUsage{
|
||||
usage := api.ResourceQuota{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: quota.Name,
|
||||
Namespace: quota.Namespace,
|
||||
ResourceVersion: quota.ResourceVersion},
|
||||
ResourceVersion: quota.ResourceVersion,
|
||||
Labels: quota.Labels,
|
||||
Annotations: quota.Annotations},
|
||||
Status: api.ResourceQuotaStatus{
|
||||
Hard: api.ResourceList{},
|
||||
Used: api.ResourceList{},
|
||||
@@ -206,7 +208,8 @@ func (rm *ResourceQuotaManager) syncResourceQuota(quota api.ResourceQuota) (err
|
||||
|
||||
// update the usage only if it changed
|
||||
if dirty {
|
||||
return rm.kubeClient.ResourceQuotaUsages(usage.Namespace).Create(&usage)
|
||||
_, err = rm.kubeClient.ResourceQuotas(usage.Namespace).Status(&usage)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -141,7 +141,7 @@ func TestSyncResourceQuota(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
expectedUsage := api.ResourceQuotaUsage{
|
||||
expectedUsage := api.ResourceQuota{
|
||||
Status: api.ResourceQuotaStatus{
|
||||
Hard: api.ResourceList{
|
||||
api.ResourceCPU: resource.MustParse("3"),
|
||||
@@ -166,7 +166,7 @@ func TestSyncResourceQuota(t *testing.T) {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
|
||||
usage := kubeClient.ResourceQuotaUsage
|
||||
usage := kubeClient.ResourceQuotaStatus
|
||||
|
||||
// ensure hard and used limits are what we expected
|
||||
for k, v := range expectedUsage.Status.Hard {
|
||||
|
Reference in New Issue
Block a user