Skip to content

Show Cost Factored Storage Size of Forks on Usage Quotas Page

What does this MR do and why?

Show the cost factored storage size of forks on the Usage quotas page.

Display the cost factored total storage size and the actual size in smaller parenthetical text below it.

The storage size will be reduced for all forks in a premium or ultimate namespace. The storage size will be reduced for public and internal forks on a free namespace. This behavior is due to the changes in !125050 (merged) which determine if the cost factored storage size will be reduced or equal to the storage size.

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/393580

Screenshots or screen recordings

Solar System Group is on a free plan. Alpha Centauri Station Fork is a fork of a public project and so it has a cost factor applied to its storage size. Asteroid 561z Fork is a fork of a private project and so it does not have a cost factor applied.

ForkStorageSizeSaas

The changes in this MR also affect the Profiles (User) Usage quotas page:

UserUsageQuotasFork

How to set up and validate locally

  1. Enable namespace storage limits.

  2. Edit the Namespaces::Storage::RootSize::COST_FACTOR_FOR_FORKS constant to be something between 0 and 1:

diff --git a/ee/app/models/namespaces/storage/root_size.rb b/ee/app/models/namespaces/storage/root_size.rb
index 024537a5ee9d..eb536f8a002d 100644
--- a/ee/app/models/namespaces/storage/root_size.rb
+++ b/ee/app/models/namespaces/storage/root_size.rb
@@ -6,7 +6,7 @@ class RootSize
       CURRENT_SIZE_CACHE_KEY = 'root_storage_current_size'
       EXPIRATION_TIME = 10.minutes
       LIMIT_CACHE_NAME = 'root_storage_size_limit'
-      COST_FACTOR_FOR_FORKS = 1.0
+      COST_FACTOR_FOR_FORKS = 0.1
 
       def initialize(root_namespace)
         @root_namespace = root_namespace.root_ancestor # just in case the true root isn't passed
  1. Visit the Usage quotas page, and any forks should display a reduced Total storage size with the actual total size in smaller text beneath.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jason Goodman

Merge request reports