Codebase Review Round 2 — Finding #13
Severity: Important
Location: Various controller files
Problem
The codebase uses three different reconciliation patterns, three different create-or-update patterns, and GRPCRoute deletion diverges from other resource types. This inconsistency makes the controllers harder to understand and maintain.
Reconciliation patterns found:
- Direct reconcile with no generation check
- Reconcile with generation check but different implementations
- Reconcile with status update on every run
Create-or-update patterns found:
- Get → Create/Update with error wrapping
- Get → Create/Update without error wrapping
- controllerutil.CreateOrUpdate
Deletion:
- GRPCRoute deletion uses a different pattern from all other resource types
Fix
- Standardize all controllers to use
reconcileWithGenerationCheck pattern
- Create a shared
reconcileResource helper for the create-or-update pattern
- Standardize deletion to use
handleResourceDeletion consistently across all resource types including GRPCRoute
Codebase Review Round 2 — Finding #13
Severity: Important
Location: Various controller files
Problem
The codebase uses three different reconciliation patterns, three different create-or-update patterns, and GRPCRoute deletion diverges from other resource types. This inconsistency makes the controllers harder to understand and maintain.
Reconciliation patterns found:
Create-or-update patterns found:
Deletion:
Fix
reconcileWithGenerationCheckpatternreconcileResourcehelper for the create-or-update patternhandleResourceDeletionconsistently across all resource types including GRPCRoute