Refactor KubernetesClient class
Context
The KubernetesClient
class is too complex for what it's supposed to accomplish. It's a small technical debt I encounter every time I need to find a bug in it.
From Draft to Ready
-
Merge !112658 (merged) -
!114270 (merged) is merged, and we rebased master onto this branch
What does this MR do?
This MR reduces the technical debt in this class by making it a bit more straightforward.
- Refactored the specs for the
KubernetesClient
class🎉 - Makes
scripts/review_apps/automated_cleanup.rb
ready for helm3 (we also added specs for this class in !114270 (merged), so that we are more confident with this refactor) - Split
cleanup_by_created_at
generic method into two more specific methods:cleanup_namespaces_by_created_at
andcleanup_pvcs_by_created_at
- Fix a PVC deletion bug.
- With helm 2, we created all the PVCs in the
review-apps
namespace. This has changed in Helm 3, and therefore, we didn't properly delete PVCs anymore in the cluster.
- With helm 2, we created all the PVCs in the
- Adds the possibility to run
review-cleanup
in dry-run mode by passingDRY_RUN
to the manual job.
Does it work?
- The
review-cleanup
dry-run job was run in https://gitlab.com/gitlab-org/gitlab/-/jobs/3953335047
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by David Dieulivol