summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-13 12:15:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-13 12:15:20 +0000
commit944a3a7b7e19354abdfcaa79129d0736c4b8565f (patch)
tree627802e84525946f11fdd6976ab5f04fb69e702c /scripts
parent62798ed33c878f936009da05fdddb707e1c7d58d (diff)
downloadgitlab-ce-944a3a7b7e19354abdfcaa79129d0736c4b8565f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/review_apps/automated_cleanup.rb12
-rwxr-xr-xscripts/review_apps/k8s-resources-count-checks.sh9
2 files changed, 9 insertions, 12 deletions
diff --git a/scripts/review_apps/automated_cleanup.rb b/scripts/review_apps/automated_cleanup.rb
index 36472056e76..154a73462bb 100755
--- a/scripts/review_apps/automated_cleanup.rb
+++ b/scripts/review_apps/automated_cleanup.rb
@@ -183,12 +183,6 @@ module ReviewApps
kubernetes.cleanup_namespaces_by_created_at(created_before: threshold_time(days: days)) unless dry_run
end
- def perform_stale_pvc_cleanup!(days:)
- puts "Dry-run mode." if dry_run
-
- kubernetes.cleanup_pvcs_by_created_at(created_before: threshold_time(days: days)) unless dry_run
- end
-
private
attr_reader :api_endpoint, :dry_run, :gitlab_token, :project_path
@@ -322,10 +316,4 @@ if $PROGRAM_NAME == __FILE__
timed('Stale Namespace cleanup') do
automated_cleanup.perform_stale_namespace_cleanup!(days: 3)
end
-
- puts
-
- timed('Stale PVC cleanup') do
- automated_cleanup.perform_stale_pvc_cleanup!(days: 30)
- end
end
diff --git a/scripts/review_apps/k8s-resources-count-checks.sh b/scripts/review_apps/k8s-resources-count-checks.sh
index b63fa043065..7ce98f8d164 100755
--- a/scripts/review_apps/k8s-resources-count-checks.sh
+++ b/scripts/review_apps/k8s-resources-count-checks.sh
@@ -15,6 +15,9 @@ function k8s_resource_count() {
SERVICES_COUNT_THRESHOLD=3000
REVIEW_APPS_COUNT_THRESHOLD=200
+# One review app currently deploys 4 PVCs
+PVCS_COUNT_THRESHOLD=$((REVIEW_APPS_COUNT_THRESHOLD * 4))
+
exit_with_error=false
# In the current GKE cluster configuration, we should never go higher than 4096 services per cluster.
@@ -36,6 +39,12 @@ if [ "$(echo $(($namespaces_count - $review_apps_count)) | sed 's/-//')" -gt 30
exit_with_error=true
fi
+pvcs_count=$(kubectl get pvc -A | wc -l | xargs)
+if [ "${pvcs_count}" -gt "${PVCS_COUNT_THRESHOLD}" ]; then
+ >&2 echo "❌ [ERROR] PVCs are above ${PVCS_COUNT_THRESHOLD} (currently at ${pvcs_count})"
+ exit_with_error=true
+fi
+
if [ "${exit_with_error}" = true ] ; then
exit 1
fi