Skip to content

Commit e36c7d7

Browse files
authored
fix: allow unsetting quota (#1367)
Closes #1365.
1 parent 167bceb commit e36c7d7

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

components/renku_data_services/crc/api.spec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ paths:
303303
- resource_pools
304304
patch:
305305
summary: Update specific fields of an existing resource pool
306+
description: |
307+
Note that the quota cannot be removed using the PATCH method.
308+
To remove the quota, use the PUT method and unset the quota field.
306309
parameters:
307310
- in: path
308311
name: resource_pool_id

components/renku_data_services/crc/apispec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2026-05-28T15:57:22+00:00
3+
# timestamp: 2026-06-29T12:51:11+00:00
44

55
from __future__ import annotations
66

components/renku_data_services/crc/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def validate_resource_pool_put_or_patch(
217217
classes = (
218218
[validate_resource_class_patch_or_put(body=rc, method=method) for rc in body.classes] if body.classes else None
219219
)
220-
quota = validate_quota_put_patch(body=body.quota) if body.quota else None
220+
quota = validate_quota_put_patch(body=body.quota) if body.quota else RESET if method == "PUT" else None
221221
remote = None
222222
match body.remote:
223223
case apispec.RemoteConfigurationPatchReset() as r:

components/renku_data_services/crc/db.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,8 @@ async def update_resource_pool(
638638
if update.quota is RESET and rp.quota:
639639
# Remove the existing quota
640640
await self.quotas_repo.delete_quota(name=rp.quota, cluster_id=cluster_id)
641+
rp.quota = None
642+
quota = None
641643
elif isinstance(update.quota, models.QuotaPatch) and rp.quota is None:
642644
# Create a new quota, the `update.quota` object has already been validated
643645
assert update.quota.cpu is not None

0 commit comments

Comments
 (0)