From e1189e4c3b8bd5535104f458f5af7505789eac00 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 13 Jul 2021 15:08:38 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- scripts/review_apps/automated_cleanup.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts/review_apps') 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 -- cgit v1.2.1