chore: remove operator cleanup logic #1836
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the cleanupOldResources logic executed during the operator's startup sequence and its associated unit tests.
Removed cleanupOldResources function from pkg/operator/operator.go.
Removed the call to cleanupOldResources within the main Run loop.
Deleted pkg/operator/operator_test.go as it solely contained TestCleanupOldResources.
Cleaned up unused imports (k8s admissionregistration, apierrors, etc.).
Reasoning
The cleanupOldResources function handled legacy migrations (specifically deleting old ValidatingWebhookConfiguration and unannotated Collector/RuleEvaluator resources). This logic is no longer required for current versions of the operator. Removing it simplifies the startup path and removes technical debt. The only risk would be failure to automatically clear resources upon upgrades
Internal reference: b/422809019