Skip to content

Conversation

@hsmatulis
Copy link
Collaborator

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

@bernot-dev
Copy link
Collaborator

Looks like a good change, overall. Let's get the tests passing.

@bernot-dev bernot-dev self-requested a review January 8, 2026 17:24
@hsmatulis hsmatulis force-pushed the hsmatulis-rm-cleanupOldResources branch from 2492613 to 5749bf7 Compare January 8, 2026 20:47
b/422809019

Signed-off-by: Henrique Matulis <[email protected]>
@hsmatulis hsmatulis force-pushed the hsmatulis-rm-cleanupOldResources branch from 5749bf7 to 198df86 Compare January 8, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants