From 4c685bac49c852ef5f6b0121ce27a2b71bf4500e Mon Sep 17 00:00:00 2001 From: Francesco Timperi Tiberi Date: Wed, 8 Nov 2023 16:50:42 +0000 Subject: [PATCH] feature: added capability to set storage.quota to auto defaulting to unlimited storage. This is required to simplify olaris task configuration --- deploy/nuvolaris-permissions/whisk-user-crd.yaml | 4 ++-- nuvolaris/minio.py | 11 +++++++---- tests/kind/whisk-user.yaml | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/deploy/nuvolaris-permissions/whisk-user-crd.yaml b/deploy/nuvolaris-permissions/whisk-user-crd.yaml index 4acd750..a2079aa 100644 --- a/deploy/nuvolaris-permissions/whisk-user-crd.yaml +++ b/deploy/nuvolaris-permissions/whisk-user-crd.yaml @@ -103,8 +103,8 @@ spec: description: password to access the internal MINIO instance type: string quota: - description: maximum quota assignable in mb to each defined bucket, If omitted il will be equivalent to unlimited - type: integer + description: maximum quota assignable in mb to each defined bucket. Defaults to auto which will not set any specific quota + type: string data: description: used to configure the user MINIO dedicated buckets type: object diff --git a/nuvolaris/minio.py b/nuvolaris/minio.py index a88b1da..4055583 100644 --- a/nuvolaris/minio.py +++ b/nuvolaris/minio.py @@ -146,11 +146,14 @@ def create_nuv_storage(data): logging.info(f"*** configured MINIO storage for nuvolaris") def assign_bucket_quota(bucket_name, quota, minioClient:MinioClient): - logging.info(f"*** setting quota on bucket {bucket_name} with hardlimit to {quota}m") - res = minioClient.assign_quota_to_bucket(bucket_name,quota) + if not quota.lower() in ['auto'] and quota.isnumeric(): + logging.info(f"*** setting quota on bucket {bucket_name} with hardlimit to {quota}m") + res = minioClient.assign_quota_to_bucket(bucket_name,quota) - if res: - logging.info(f"*** quota on bucket {bucket_name} set successfully") + if res: + logging.info(f"*** quota on bucket {bucket_name} set successfully") + else: + logging.warn(f"*** skipping quota set on bucket {bucket_name}. Requested quota values is {quota}") def create_ow_storage(state, ucfg: UserConfig, user_metadata: UserMetadata, owner=None): diff --git a/tests/kind/whisk-user.yaml b/tests/kind/whisk-user.yaml index 24b02eb..f3270d0 100644 --- a/tests/kind/whisk-user.yaml +++ b/tests/kind/whisk-user.yaml @@ -31,7 +31,7 @@ spec: password: fttredispwd object-storage: password: vPtIjR2MFMlYY7U5BY6N7TTogZXnJa8cl6ygPGnJIXOJonfA6MuNpVAdLN7m8iVc - quota: 100 + quota: "100" data: enabled: true bucket: franztt-data