-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds API endpoints for quota management (#1197)
Co-authored-by: Steven Smith <[email protected]>
- Loading branch information
Showing
8 changed files
with
296 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
[id="quota-limit-management-api"] | ||
= Setting quota limits for an organization with the {productname} API | ||
|
||
You can set specific quota limits for an organization so that, when exceeded, a warning is returned, or the pushed image is denied altogether. | ||
|
||
.Procedure | ||
|
||
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createorganizationquotalimit[`POST /api/v1/organization/{orgname}/quota/{quota_id}/limit`] command to create a quota policy that rejects images if they exceeded the allotted quota. For example: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X POST "https://<quay-server.example.com>/api/v1/organization/<orgname>/quota/<quota_id>/limit" \ | ||
-H "Authorization: Bearer <access_token>" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"limit_bytes": 21474836480, | ||
"type": "Reject", <1> | ||
"threshold_percent": 90 <2> | ||
}' | ||
---- | ||
<1> One of `Reject` or `Warning`. | ||
<2> Quota threshold, in percent of quota. | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
"Created" | ||
---- | ||
|
||
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#listorganizationquotalimit[`GET /api/v1/organization/{orgname}/quota/{quota_id}/limit`] to obtain the ID of the quota limit. For example: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/quota/<quota_id>/limit" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
[{"id": 2, "type": "Reject", "limit_percent": 90}] | ||
---- | ||
|
||
//// | ||
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getuserquotalimit[`GET /api/v1/user/quota/{quota_id}/limit/{limit_id}`] endpoint to return information about the quota limit. Note that this requires the limit ID. For example: | ||
+ | ||
[source,terminal] | ||
---- | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
---- | ||
//// | ||
|
||
. Update the policy with the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#changeorganizationquotalimit[`PUT /api/v1/organization/{orgname}/quota/{quota_id}/limit/{limit_id}`] endpoint. For example: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X PUT "https://<quay-server.example.com>/api/v1/organization/<orgname>/quota/<quota_id>/limit/<limit_id>" \ | ||
-H "Authorization: Bearer <access_token>" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"type": "<type>", | ||
"threshold_percent": <threshold_percent> | ||
}' | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
{"id": 3, "limit_bytes": 10737418240, "limit": "10.0 GiB", "default_config": false, "limits": [{"id": 2, "type": "Warning", "limit_percent": 80}], "default_config_exists": false} | ||
---- | ||
|
||
. You can delete the quota limit with the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#deleteorganizationquotalimit[`DELETE /api/v1/organization/{orgname}/quota/{quota_id}/limit/{limit_id}`] endpoint: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/<orgname>/quota/<quota_id>/limit/<limit_id>" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
This command does not return output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
[id="quota-limit-user-api"] | ||
= Obtaining quota limits for the user with the {productname} API | ||
|
||
You can specify quota and limitations for users so that, when exceeded, a warning is returned, or the pushed image is denied altogether. Quota limits for users must be set on the {productname} UI. The following APIs can be used to view the quota limits for the user that is logged in. | ||
|
||
.Procedure | ||
|
||
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#listuserquota[`GET /api/v1/user/quota`] command to return information about the quota limitations: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/user/quota" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
[{"id": 4, "limit_bytes": 2199023255552, "limit": "2.0 TiB", "default_config": false, "limits": [], "default_config_exists": false}] | ||
---- | ||
|
||
. After you have received the quota ID, you can pass it in with the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getuserquota[`GET /api/v1/user/quota/{quota_id}`] endpoint to return information about the limitation: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/user/quota/{quota_id}" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
{"id": 4, "limit_bytes": 2199023255552, "limit": "2.0 TiB", "default_config": false, "limits": [], "default_config_exists": false} | ||
---- | ||
|
||
. The limitations can be viewed by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#listuserquotalimit[`GET /api/v1/user/quota/{quota_id}/limit`] endpoint. For example: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/user/quota/{quota_id}/limit" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
[{"id": 3, "type": "Reject", "limit_percent": 100}] | ||
---- | ||
|
||
. Additional information about the entire policy can be returned using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#getuserquotalimit[`GET /api/v1/user/quota/{quota_id}/limit/{limit_id}`] endpoint: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/user/quota/{quota_id}/limit/{limit_id}" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
{"id": 4, "limit_bytes": 2199023255552, "limit": "2.0 TiB", "default_config": false, "limits": [{"id": 3, "type": "Reject", "limit_percent": 100}], "default_config_exists": false} | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[id="quota-management-api"] | ||
= Establishing quota with the {productname} API | ||
|
||
You can establish quota for an organization or users, and tailor quota policies to suit the needs of your registry. | ||
|
||
The following sections show you how to establish quota for an organization, a user, and then how to modify those settings. |
Oops, something went wrong.