Skip to content

Commit

Permalink
add system quota
Browse files Browse the repository at this point in the history
Signed-off-by: lengrongfu <[email protected]>
  • Loading branch information
lengrongfu committed Jun 7, 2023
1 parent b4c27b4 commit 6737df9
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions proposals/new/system-quota.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# System Quota

Author: Leng RongFu

## Abstract

Harbor enforces quotas on resource usage of system , setting a hard limit on storage your system can use and can not push artificial when user storage more than system write storage limit.


## Background

Currently, users can set project storage quota, but every project quota is independent,maybe this project storage quota sum while more then system storage, so we need set system storage quota, in the set project storage quota is to check current project storage quota whether more then system storage quota.


## User Stories

### Story 1
As a system administrator, I can set the default limit on system storage.

## Premise
1, The shared blob in project won't be be double-counted.
2, The shared blob cross project will be be double-counted.

## Proposal

We propose the following solutions:

1. In the quota management page when administration update project quota, get system storage quota, if values is -1. skip validate.
2. else validate whether sum of all quotas more than the system quota.

### APIs for system storage quota

1. Get quotas

```
GET /api/v2.0/configurations
{
"hard_storage": {
"editable": true,
"value": "1G"# when user not setting, system default value is -1.
}
}
```
2. Update quota
```
PUT /api/v2.0/configurations
{
"hard_storage":"1G",
}
```
### Configurations Manager
Update `AllConfigs(ctx context.Context) (map[string]interface{}, error)` and `UpdateUserConfigs(ctx context.Context, conf map[string]interface{}) error` method.
### Project Manager
1. Update project quota
- Get system hard storage limit.
- List all quota info, calculate the sum of the current project quota.
- Check whether the system storage quota is exceeded.

0 comments on commit 6737df9

Please sign in to comment.