diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-13 18:08:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-13 18:08:38 +0300 |
commit | e1189e4c3b8bd5535104f458f5af7505789eac00 (patch) | |
tree | 1a3e2e536e66120c60a6088329349f323de2d14b /scripts/review_apps | |
parent | 8ce82c1eaf87d1b22b645e2c37671f01d2c35581 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/review_apps')
-rwxr-xr-x | scripts/review_apps/automated_cleanup.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/review_apps/automated_cleanup.rb b/scripts/review_apps/automated_cleanup.rb index 0927481070b..5707f02d3f0 100755 --- a/scripts/review_apps/automated_cleanup.rb +++ b/scripts/review_apps/automated_cleanup.rb @@ -116,6 +116,12 @@ class AutomatedCleanup delete_helm_releases(releases_to_delete) end + def perform_stale_namespace_cleanup!(days:) + kubernetes_client = Tooling::KubernetesClient.new(namespace: nil) + + kubernetes_client.cleanup_review_app_namespaces(created_before: threshold_time(days: days), wait: false) + end + def perform_stale_pvc_cleanup!(days:) kubernetes.cleanup_by_created_at(resource_type: 'pvc', created_before: threshold_time(days: days), wait: false) end @@ -203,6 +209,10 @@ timed('Helm releases cleanup') do automated_cleanup.perform_helm_releases_cleanup!(days: 7) end +timed('Stale Namespace cleanup') do + automated_cleanup.perform_stale_namespace_cleanup!(days: 14) +end + timed('Stale PVC cleanup') do automated_cleanup.perform_stale_pvc_cleanup!(days: 30) end |