Skip to content

[Important] Controller pattern standardization: reconciliation, create-or-update, deletion #974

@piwi3910

Description

@piwi3910

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:

  1. Direct reconcile with no generation check
  2. Reconcile with generation check but different implementations
  3. Reconcile with status update on every run

Create-or-update patterns found:

  1. Get → Create/Update with error wrapping
  2. Get → Create/Update without error wrapping
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions