diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /scripts/review_apps | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'scripts/review_apps')
-rwxr-xr-x | scripts/review_apps/automated_cleanup.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/review_apps/automated_cleanup.rb b/scripts/review_apps/automated_cleanup.rb index e40c6cd7276..bef5b7ad5ee 100755 --- a/scripts/review_apps/automated_cleanup.rb +++ b/scripts/review_apps/automated_cleanup.rb @@ -115,6 +115,10 @@ class AutomatedCleanup delete_helm_releases(releases_to_delete) end + def perform_stale_pvc_cleanup!(days:) + kubernetes.cleanup_by_created_at(resource_type: 'pvc', created_before: threshold_time(days: days), wait: false) + end + private def fetch_environment(environment) @@ -155,7 +159,7 @@ class AutomatedCleanup releases_names = releases.map(&:name) helm.delete(release_name: releases_names) - kubernetes.cleanup(release_name: releases_names, wait: false) + kubernetes.cleanup_by_release(release_name: releases_names, wait: false) rescue Tooling::Helm3Client::CommandFailedError => ex raise ex unless ignore_exception?(ex.message, IGNORED_HELM_ERRORS) @@ -198,4 +202,8 @@ timed('Helm releases cleanup') do automated_cleanup.perform_helm_releases_cleanup!(days: 7) end +timed('Stale PVC cleanup') do + automated_cleanup.perform_stale_pvc_cleanup!(days: 30) +end + exit(0) |