Remove excess zoekt replicas
What does this MR do and why?
Removes excess zoekt replicas.
AI Summary
This code adds a new automated cleanup system for a search feature called Zoekt. The system monitors search replicas (copies of data used for faster searching) and automatically removes excess ones when there are too many.
Here's what it does:
Adds monitoring: Creates a new background check that runs periodically to identify namespaces (groups/projects) that have more search replicas than they're supposed to have.
Adds cleanup logic: When excess replicas are found, the system automatically deletes the extra ones to bring the count back to the desired number. Each namespace can have either a custom replica limit or use a default setting.
Processes in batches: To avoid overwhelming the system, it processes up to 100 namespaces at a time and schedules follow-up work if more cleanup is needed.
Includes safety measures: The system logs how many replicas were removed and includes comprehensive tests to ensure it works correctly in various scenarios.
The main benefit is that this prevents storage waste and maintains optimal performance by ensuring search replicas don't accumulate beyond what's actually needed. It's a "set it and forget it" solution that runs automatically in the background.
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.