11:_mod-docs-content-type: PROCEDURE
22
33[id="quota-establishment-api"]
4- = Establishing quota for an organization with the {productname} API
4+ = Managing quota limits by using the API
55
66When an organization is first created, it does not have an established quota. You can use the API to check, create, change, or delete quota limitations for an organization.
77
88.Prerequisites
99
1010* You have generated an OAuth access token.
1111
12+ [id="setting-quota-api"]
13+ == Setting quota by using the API
14+
15+ Use the following procedure to set quota limitations by using the {productname} API.
16+
1217.Procedure
1318
1419. To set a quota for an organization, you can use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_reference/index#createorganizationquota[`POST /api/v1/organization/{orgname}/quota`] endpoint:
@@ -61,35 +66,21 @@ $ curl -X PUT "https://<quay-server.example.com>/api/v1/organization/<orgname>/q
6166{"id": 1, "limit_bytes": 21474836480, "limit": "20.0 GiB", "default_config": false, "limits": [], "default_config_exists": false}
6267----
6368
64- == Pushing images
65-
66- To see the storage consumed, push various images to the organization.
67-
68- === Pushing ubuntu:18.04
69-
70- Push ubuntu:18.04 to the organization from the command line:
71-
72- .Sample commands
73- [source,terminal]
74- ----
75- $ podman pull ubuntu:18.04
76-
77- $ podman tag docker.io/library/ubuntu:18.04 example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:18.04
78-
79- $ podman push --tls-verify=false example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:18.04
80- ----
69+ [id="viewing-quota-usage-api"]
70+ == Viewing quota usage by using the API
8171
72+ Use the following procedure to view quota usage by using the {productname} API.
8273
83- === Using the API to view quota usage
84-
85- To view the storage consumed, `GET` data from the */api/v1/repository* endpoint:
74+ .Procedure
8675
76+ * To view the storage consumed, `GET` data from the */api/v1/repository* endpoint:
77+ +
8778.Sample command
8879[source,terminal]
8980----
9081$ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: application/json' 'https://example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/api/v1/repository?last_modified=true&namespace=testorg&popularity=true&public=true' | jq
9182----
92-
83+ +
9384.Sample output
9485[source,json]
9586----
@@ -114,21 +105,7 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicatio
114105}
115106----
116107
117- === Pushing another image
118-
119- . Pull, tag, and push a second image, for example, `nginx`:
120- +
121- .Sample commands
122- [source,terminal]
123- ----
124- $ podman pull nginx
125-
126- $ podman tag docker.io/library/nginx example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/nginx
127-
128- $ podman push --tls-verify=false example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/nginx
129- ----
130-
131- . To view the quota report for the repositories in the organization, use the */api/v1/repository* endpoint:
108+ * To view the quota report for the repositories in the organization, use the */api/v1/repository* endpoint:
132109+
133110.Sample command
134111[source,terminal]
@@ -175,7 +152,7 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicatio
175152}
176153----
177154
178- . To view the quota information in the organization details, use the */api/v1/organization/{orgname}* endpoint:
155+ * To view the quota information in the organization details, use the */api/v1/organization/{orgname}* endpoint:
179156+
180157.Sample command
181158[source,terminal]
@@ -203,41 +180,41 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicatio
203180}
204181----
205182
206- == Rejecting pushes using quota limits
207-
208- If an image push exceeds defined quota limitations, a soft or hard check occurs:
183+ [id="setting-reject-warning-limits"]
184+ == Setting reject and warning limits by using the API
209185
210- * For a soft check, or _warning_, users are notified.
211- * For a hard check, or _reject_, the push is terminated.
186+ You can set _reject_ and _warning_ limits by using the {productname} API.
212187
213- === Setting reject and warning limits
214-
215- To set _reject_ and _warning_ limits, POST data to the */api/v1/organization/{orgname}/quota/{quota_id}/limit* endpoint:
188+ .Procedure
216189
217- .Sample reject limit command
190+ * To set _reject_ and _warning_ limits, `POST` data to the */api/v1/organization/{orgname}/quota/{quota_id}/limit* endpoint. For example:
191+ +
218192[source,terminal]
219193----
220194$ curl -k -X POST -H "Authorization: Bearer <token>" -H 'Content-Type: application/json' -d '{"type":"Reject","threshold_percent":80}' https://example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/api/v1/organization/testorg/quota/1/limit
221195----
222-
223- .Sample warning limit command
196+ +
224197[source,terminal]
225198----
226199$ curl -k -X POST -H "Authorization: Bearer <token>" -H 'Content-Type: application/json' -d '{"type":"Warning","threshold_percent":50}' https://example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/api/v1/organization/testorg/quota/1/limit
227200----
228201
229- === Viewing reject and warning limits
202+ [id="viewing-reject-warning-limits"]
203+ == Viewing reject and warning limits by using the API
230204
231- To view the _reject_ and _warning_ limits, use the */api/v1/organization/{orgname}/quota* endpoint:
205+ You can use the {productname} API to view reject and warning limits.
206+
207+ .Procedure
232208
233- .View quota limits
209+ . View the _reject_ and _warning_ limits by using the */api/v1/organization/{orgname}/quota* endpoint. For example:
210+ +
234211[source,terminal]
235212----
236213$ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: application/json' https://example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/api/v1/organization/testorg/quota | jq
237214----
238-
239-
240- .Sample output for quota limits
215+ +
216+ .Example output
217+ +
241218[source,json]
242219----
243220[
@@ -260,53 +237,4 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicati
260237 "default_config_exists": false
261238 }
262239]
263- ----
264-
265- === Pushing an image when the reject limit is exceeded
266-
267- In this example, the reject limit (80%) has been set to below the current repository size (~83%), so the next push should automatically be rejected.
268-
269- Push a sample image to the organization from the command line:
270-
271- .Sample image push
272- [source,terminal]
273- ----
274- $ podman pull ubuntu:20.04
275-
276- $ podman tag docker.io/library/ubuntu:20.04 example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:20.04
277-
278- $ podman push --tls-verify=false example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:20.04
279- ----
280-
281- .Sample output when quota exceeded
282- [source,terminal]
283- ----
284- Getting image source signatures
285- Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
286- Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
287- Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
288- WARN[0002] failed, retrying in 1s ... (1/3). Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace
289- Getting image source signatures
290- Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
291- Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
292- Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
293- WARN[0005] failed, retrying in 1s ... (2/3). Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace
294- Getting image source signatures
295- Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
296- Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
297- Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
298- WARN[0009] failed, retrying in 1s ... (3/3). Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace
299- Getting image source signatures
300- Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
301- Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
302- Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
303- Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace
304- ----
305-
306-
307- === Notifications for limits exceeded
308-
309- When limits are exceeded, a notification appears:
310-
311- .Quota notifications
312- image:quota-notifications.png[Quota notifications]
240+ ----
0 commit comments