1
1
:_mod-docs-content-type: PROCEDURE
2
2
3
3
[id="quota-establishment-api"]
4
- = Establishing quota for an organization with the {productname} API
4
+ = Managing quota limits by using the API
5
5
6
6
When 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.
7
7
8
8
.Prerequisites
9
9
10
10
* You have generated an OAuth access token.
11
11
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
+
12
17
.Procedure
13
18
14
19
. 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
61
66
{"id": 1, "limit_bytes": 21474836480, "limit": "20.0 GiB", "default_config": false, "limits": [], "default_config_exists": false}
62
67
----
63
68
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
81
71
72
+ Use the following procedure to view quota usage by using the {productname} API.
82
73
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
86
75
76
+ * To view the storage consumed, `GET` data from the */api/v1/repository* endpoint:
77
+ +
87
78
.Sample command
88
79
[source,terminal]
89
80
----
90
81
$ 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
91
82
----
92
-
83
+ +
93
84
.Sample output
94
85
[source,json]
95
86
----
@@ -114,21 +105,7 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicatio
114
105
}
115
106
----
116
107
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:
132
109
+
133
110
.Sample command
134
111
[source,terminal]
@@ -175,7 +152,7 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicatio
175
152
}
176
153
----
177
154
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:
179
156
+
180
157
.Sample command
181
158
[source,terminal]
@@ -203,41 +180,41 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicatio
203
180
}
204
181
----
205
182
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
209
185
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.
212
187
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
216
189
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
+ +
218
192
[source,terminal]
219
193
----
220
194
$ 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
221
195
----
222
-
223
- .Sample warning limit command
196
+ +
224
197
[source,terminal]
225
198
----
226
199
$ 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
227
200
----
228
201
229
- === Viewing reject and warning limits
202
+ [id="viewing-reject-warning-limits"]
203
+ == Viewing reject and warning limits by using the API
230
204
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
232
208
233
- .View quota limits
209
+ . View the _reject_ and _warning_ limits by using the */api/v1/organization/{orgname}/quota* endpoint. For example:
210
+ +
234
211
[source,terminal]
235
212
----
236
213
$ 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
237
214
----
238
-
239
-
240
- .Sample output for quota limits
215
+ +
216
+ .Example output
217
+ +
241
218
[source,json]
242
219
----
243
220
[
@@ -260,53 +237,4 @@ $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: applicati
260
237
"default_config_exists": false
261
238
}
262
239
]
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