You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/managing-namespace-auto-pruning-policies.adoc
+118-9Lines changed: 118 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
[id="managing-namespace-auto-pruning-policies"]
3
3
= Managing auto-pruning policies using the {productname} UI
4
4
5
-
All auto-pruning policies, with the exception of a registry-wide auto pruning policy, are created using the {productname} v2 UI. This can be done after you have configured your {productname}`config.yaml` file to enable the auto-pruning feature and the v2 UI.
5
+
All auto-pruning policies, with the exception of a registry-wide auto pruning policy, are created using the {productname} v2 UI or by using the API. This can be done after you have configured your {productname}`config.yaml` file to enable the auto-pruning feature and the v2 UI.
. Select the desired number of tags to keep. By default, this is set at *20* tags. For this example, the number of tags to keep is set at *3*.
193
193
194
+
. Optional. To prune only tags that match the given regex pattern, click the *Tag pattern* box and select *match*. In the regex box, enter a pattern to match tags against. For example, to automatically prune all `test` tags, enter `^test.*`. To prune a specific image, you can enter `^test1$`.
195
+
196
+
. Optional. You can create a second auto-prune policy by clicking *Add Policy* and entering the required information.
197
+
194
198
. Click *Save*. A notification that your auto-prune policy has been updated appears.
195
199
196
200
.Verification
@@ -212,7 +216,7 @@ You can use {productname} API endpoints to manage auto-pruning policies for an n
212
216
213
217
.Procedure
214
218
215
-
. Enter the following `POST` command create a new policy that limits the number of tags allowed in an organization:
219
+
. Enter the following link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createorganizationautoprunepolicy[`POST /api/v1/organization/{orgname}/autoprunepolicy/`] command create a new policy that limits the number of tags allowed in an organization:
. Optional. You can add an additional policy to an organization and pass in the `tagPattern` and `tagPatternMatches` fields to prune only tags that match the given regex pattern. For example:
Attempting to create multiple policies returns the following error:
258
+
[source,terminal]
259
+
----
260
+
{"uuid": "ebf7448b-93c3-4f14-bf2f-25aa6857c7b0"}
261
+
----
262
+
263
+
. You can update your organization's auto-prune policy by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#updateorganizationautoprunepolicy[`PUT /api/v1/organization/{orgname}/autoprunepolicy/{policy_uuid}`] command. For example:
237
264
+
238
265
[source,terminal]
239
266
----
240
-
{"detail": "Policy for this namespace already exists, delete existing to create new policy", "error_message": "Policy for this namespace already exists, delete existing to create new policy", "error_type": "invalid_request", "title": "invalid_request", "type": "http://<quay-server.example.com>/api/v1/error/invalid_request", "status": 400}
. Select the desired number of tags to keep. By default, this is set at *20* tags. For this example, the number of tags to keep is set at *3*.
399
433
434
+
. Optional. To prune only tags that match the given regex pattern, click the *Tag pattern* box and select *match*. In the regex box, enter a pattern to match tags against. For example, to automatically prune all `test` tags, enter `^test.*`. To prune a specific image, you can enter `^test1$`.
435
+
436
+
. Optional. You can create a second auto-prune policy by clicking *Add Policy* and entering the required information.
437
+
400
438
. Click *Save*. A notification that your auto-prune policy has been updated appears.
401
439
402
440
.Verification
@@ -418,7 +456,7 @@ You can use {productname} API endpoints to manage auto-pruning policies for an r
418
456
419
457
.Procedure
420
458
421
-
. Enter the following `POST` command create a new policy that limits the number of tags allowed in an organization:
459
+
. Enter the following link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#updateorganizationautoprunepolicy[`POST /api/v1/repository/{repository}/autoprunepolicy/`] command create a new policy that limits the number of tags allowed in an organization:
. Optional. You can add an additional policy and pass in the `tagPattern` and `tagPatternMatches` fields to prune only tags that match the given regex pattern. For example:
Attempting to create multiple policies returns the following error:
496
+
.Example output
443
497
+
444
498
[source,terminal]
445
499
----
446
-
{"detail": "Policy for this namespace already exists, delete existing to create new policy", "error_message": "Policy for this namespace already exists, delete existing to create new policy", "error_type": "invalid_request", "title": "invalid_request", "type": "http://quay-server.example.com/api/v1/error/invalid_request", "status": 400}
500
+
{"uuid": "b53d8d3f-2e73-40e7-96ff-736d372cd5ef"}
447
501
----
448
502
503
+
. You can update your policy for the repository by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#updaterepositoryautoprunepolicy[`PUT /api/v1/repository/{repository}/autoprunepolicy/{policy_uuid}`] command and passing in the UUID. For example:
This command does not return output. Continue to the next step to check your auto-prune policy.
520
+
449
521
. Check your auto-prune policy by entering the following command:
450
522
+
451
523
[source,terminal]
@@ -495,7 +567,7 @@ You can use {productname} API endpoints to manage auto-pruning policies on a rep
495
567
496
568
.Procedure
497
569
498
-
. Enter the following `POST` command create a new policy that limits the number of tags for the current user:
570
+
. Enter the following link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createuserautoprunepolicy[`POST /api/v1/user/autoprunepolicy/`] command create a new policy that limits the number of tags for the current user:
. Optional. You can add an additional policy for the current user and pass in the `tagPattern` and `tagPatternMatches` fields to prune only tags that match the given regex pattern. For example:
. You can update your policy for the current user by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#updateuserautoprunepolicy[`PUT /api/v1/user/autoprunepolicy/{policy_uuid}`] command. For example:
{productname} administrators can set up auto-pruning policies on organizations and repositories; administrators can also set up auto-pruning policies at the registry level so that they apply to all organizations, including all newly created organizations. This feature allows for image tags to be automatically deleted within an organization or a repository based on specified criteria, which allows {productname} organization owners to stay below the storage quota by automatically pruning content.
5
+
{productname} administrators can set up multiple auto-pruning policies on organizations and repositories; administrators can also set up auto-pruning policies at the registry level so that they apply to all organizations, including all newly created organizations. This feature allows for image tags to be automatically deleted within an organization or a repository based on specified criteria, which allows {productname} organization owners to stay below the storage quota by automatically pruning content.
6
6
7
7
Currently, two policies have been added:
8
8
9
9
* **Prune images by the number of tags**. For this policy, when the actual number of tags exceeds the desired number of tags, the oldest tags are deleted by their creation date until the desired number of tags is achieved.
10
10
11
11
* **Prune image tags by creation date**. For this policy, any tags with a creation date older than the given time span, for example, 10 days, are deleted.
12
12
13
-
After tags are automatically pruned, they go into the {productname} time machine, or the amount of time, after a tag is deleted, that the tag is accessible before being garbage collected. The expiration time of an image tag is dependent on your organization's settings. For more information, see link:https://access.redhat.com/documentation/en-us/red_hat_quay/3/html-single/manage_red_hat_quay/index#garbage-collection[{productname} garbage collection].
13
+
After tags are automatically pruned, they go into the {productname} time machine, or the amount of time, after a tag is deleted, that the tag is accessible before being garbage collected. The expiration time of an image tag is dependent on your organization's settings. For more information, see link:https://access.redhat.com/documentation/en-us/red_hat_quay/{producty}/html-single/manage_red_hat_quay/index#garbage-collection[{productname} garbage collection].
14
14
15
-
Users can only configure one policy per namespace or repository; this can be done through the {productname} v2 UI. Policies can also be set by using the API endpoints through the command-line interface (CLI).
15
+
Users can configure multiple policies per namespace or repository; this can be done through the {productname} v2 UI. Policies can also be set by using the API endpoints through the command-line interface (CLI).
== Prerequisites and limitations for auto-pruning and multiple policies
19
19
20
20
The following prerequisites and limitations apply to the auto-pruning feature:
21
21
22
22
* Auto-pruning is not available when using the {productname} legacy UI. You must use the v2 UI to create, view, or modify auto-pruning policies.
23
23
24
24
* Auto-pruning is only supported in databases that support the `FOR UPDATE SKIP LOCKED` SQL command.
25
25
26
-
* Auto-pruning is unavailable on mirrored repositories and read-only repositories.
26
+
* Auto-pruning is unavailable on mirrored repositories and read-only repositories.
27
+
28
+
* If you are configuring multiple auto-prune policies, rules are processed without particular order, and individual result sets are processed immediately before moving on to the next rule.
29
+
** For example, if an image is already subject for garbage collection by one rule, it cannot be excluded from pruning by another rule.
30
+
31
+
* If you have both an auto-pruning policy for an organization and a repository, the auto-pruning policies set at the organization level are executed first.
0 commit comments