Conversation
Implement a caching system for the webhook to track Kanidm objects and sync internal objects when external replication is enabled. Changes: - Add Kanidm CRD watcher to track cluster configurations - Create Kanidm client cache infrastructure for authenticated connections - Implement background task to sync internal entities (groups, persons, OAuth2 clients, service accounts) from Kanidm clusters with external replication enabled - Add entity tracking that maps entity names to their KanidmRef (cluster name and namespace) - Update validation logic to check both CRD-based objects and internally synced objects from replicated clusters - Add InternalEntityCache to track entities synced from external Kanidm clusters The webhook now prevents duplicate entity creation by checking: 1. Kubernetes CRD resources (existing behavior) 2. Internal Kanidm entities synced from clusters with external replication (new behavior) This ensures that entities replicated from external clusters cannot be accidentally recreated via CRDs, preventing conflicts in multi-cluster Kanidm deployments.
44bde81 to
ad988d6
Compare
|
@forkline could you review this PR? Don't modify it |
Code Review: Add webhook caching for Kanidm objectsOverviewThis PR implements a caching system for the webhook to track Kanidm objects and sync internal entities when external replication is enabled. The implementation prevents duplicate entity creation by checking both CRD-based objects and entities synced from external Kanidm clusters. Architecture AssessmentStrengths:
Issues & Suggestions1. Potential Resource Leak in Sync Loop (
|
|
I've reviewed PR #491 and posted a detailed code review. Summary: The PR adds webhook caching for Kanidm objects to prevent duplicate entity creation in multi-cluster deployments with external replication. The architecture is sound with proper async patterns and separation of concerns. Key issues identified:
Recommendation: Request changes for the sync loop lifecycle, error handling, and unit tests before merge. Review posted: #491 (comment) |
Implement a caching system for the webhook to track Kanidm objects and sync internal objects when external replication is enabled.
Changes:
The webhook now prevents duplicate entity creation by checking:
This ensures that entities replicated from external clusters cannot be accidentally recreated via CRDs, preventing conflicts in multi-cluster Kanidm deployments.