Skip to content

Commit aa9836f

Browse files
docs(administration): add quota management endpoints docs (reanahub#222)
1 parent a5a6aa8 commit aa9836f

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The list of contributors in alphabetical order:
55
- [Adelina Lintuluoto](https://orcid.org/0000-0002-0726-1452)
66
- [Agisilaos Kounelis](https://orcid.org/0000-0001-9312-3189)
77
- [Audrius Mecionis](https://orcid.org/0000-0002-3759-1663)
8+
- [Cameron McClymont](https://orcid.org/0009-0002-0176-5251)
89
- [Clemens Lange](https://orcid.org/0000-0002-3632-3157)
910
- [Daan Rosendal](https://orcid.org/0000-0002-3447-9000)
1011
- [Diego Rodriguez](https://orcid.org/0000-0003-0649-2002)

docs/administration/configuration/configuring-user-quotas/index.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Here is an example of a mixed configuration where, in addition to nightly CPU an
2525
```yaml
2626
quota:
2727
enabled: true
28-
# update quota usage everyday at 3AM
28+
# update quota usage every day at 3AM
2929
periodic_update_policy: "0 3 * * *"
3030
# after workflow finishes or fails update its cpu usage
3131
workflow_termination_update_policy: "cpu"
@@ -50,7 +50,9 @@ Individual users will be able to run as many workflows as they want, provided th
5050
## Setting individual quota limits
5151

5252
In addition to setting the default quota limits for all users, you may want to set different quota usage limits for different specific groups of users.
53-
This can be done via the `reana-admin` tool that is present in the `reana-server` pod.
53+
This can be done via the `reana-admin` tool that is present in the `reana-server` pod or via the REST API.
54+
55+
### Using the `reana-admin` tool
5456

5557
Log in to the `reana-server` pod:
5658

@@ -66,3 +68,55 @@ Quota limit 250000 for 'disk (shared storage)' successfully set to users ('john.
6668
```
6769

6870
You can learn more about the `quota-set` administrative command options by running `flask reana-admin quota-set --help`.
71+
72+
### Using the REST API
73+
74+
You can also set quota limits for specific users using the REST API.
75+
76+
All API requests must include an X-Quota-Management-Secret header containing a secret string.
77+
This secret should be set in your Helm `values.yaml` file.
78+
79+
```yaml
80+
components:
81+
reana_server:
82+
environment:
83+
REANA_ADMIN_QUOTA_MANAGER: "my_secret"
84+
```
85+
86+
If the secret is not set, quota management via the REST API is disabled.
87+
88+
To get the current CPU quota limit and usage for the user `[email protected]`, you would run:
89+
90+
```console
91+
$ curl -v -H "X-Quota-Management-Secret: my_secret" \
92+
https://reana.cern.ch/api/[email protected]&resource_type=cpu
93+
```
94+
95+
The response will contain the current limit and usage for the given user and resource:
96+
97+
```json
98+
{
99+
"limit": 36000000,
100+
"message": "OK",
101+
"usage": 12000000
102+
}
103+
```
104+
105+
To set a custom disk quota limit of 250 GiB to the user `[email protected]`, you would run:
106+
107+
```console
108+
$ curl -v -H "X-Quota-Management-Secret: my_secret" \
109+
-X POST \
110+
-d '{"email": "[email protected]", "resource_type": "disk", "limit": 250000000000}' \
111+
https://reana.cern.ch/api/quota
112+
```
113+
114+
The response will contain the new limit and current usage for the given user and resource:
115+
116+
```json
117+
{
118+
"limit": 250000000000,
119+
"message": "OK",
120+
"usage": 12000000
121+
}
122+
```

0 commit comments

Comments
 (0)