Update Namespace.actual_repository_size_limit
What does this MR do and why?
In this MR we're introducing plan_limits.repository_size
as part of Namespace.actual_repository_size_limit
so that we can achieve our main goal in https://gitlab.com/groups/gitlab-org/-/epics/14212
The hierarchy is as follows: projects.repository_size_limit > namespaces.repository_size_limit > plan_limits.repository_size > application_settings.repository_size_limit
References
Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Related issue: https://gitlab.com/gitlab-org/gitlab/-/issues/502227+
- New values for
plan_limits.repository_size
being discussed in https://gitlab.com/gitlab-org/gitlab/-/issues/502217+
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
repository_size_limit
Instance level Ultimate Group | Free Group |
---|---|
repository_size_limit
Plan level Here, the Ultimate
plan has a 500GiB repository_size_limit
limit
Ultimate Group | Free Group |
---|---|
repository_size_limit
Group level Here we only show the Free
plan group where before they'd have the 10GiB instance limit and after we had overridden the instance limit with a bigger one, only for their group
Free Group before | Free Group after |
---|---|
How to set up and validate locally
For this change we'll test repository_size_limit
in 3 levels: Instance, Plan, Group:
- For all levels you'll need to:
- Simulate SaaS GitLab.com and have at least one group with the Ultimate Plan (watch the video for visual instructions)
- Enable this setting in
rails console
:Gitlab::CurrentSettings.update!(automatic_purchased_storage_allocation: true)
- Make note of your Group with
Ultimate
plan and have anotherFree
plan group for comparison
-
Instance: This one is how it works for most groups in GitLab.com
Gitlab::CurrentSettings.update!(repository_size_limit: 10.gigabytes)
- Now go to your Group Usage Quotas Page, choose the storage tab:
https://gdk.test:3443/groups/<your-group>/-/usage_quotas#storage-quota-tab
- Make sure sure you see the 10GiB limit in the UI, like in the screenshots
- Alternatively you can check in
rails console
:Group.find(<group-id>).actual_repository_size_limit
-
Plan: This is the new logic being added in this MR
Plan.find_by_name('ultimate').actual_limits.update!(repository_size: 500.gigabytes)
Feature.enable(:plan_limits_repository_size)
rails cache:clear
- Now go to Usage Quotas Page and compare both groups and what limit they have
- Alternatively you can check in
rails console
:Group.find(<group-id>).actual_repository_size_limit
-
Group: This is also currently in production, we're only asserting no regression here, like in the instance case
Group.find(<group-id>).update(repository_size_limit: 25.gigabytes)
rails cache:clear
- Now go to Usage Quotas Page and compare both groups and what limit they have
- Alternatively you can check in
rails console
:Group.find(<group-id>).actual_repository_size_limit