kubernetes-replicator icon indicating copy to clipboard operation
kubernetes-replicator copied to clipboard

Inefficient Deletion Handling

Open kavishdahekar opened this issue 1 year ago • 0 comments

Describe the bug When a secret is created for replication across a large number of namespaces (e.g., 10,000) using the replicator.v1.mittwald.de/replicate-to annotation, the replicator first begins replicating the secret to all target namespaces. If the secret is deleted shortly afterward, the replicator does not stop but completes the initial replication to all the 10k namespaces before detecting the deletion event. This causes it to then later remove the replicated secret from all 10,000 namespaces, resulting in unnecessary replication and deletion operations that consume significant resources.

To Reproduce

  1. Create a secret in a source namespace and configure it to replicate to 10,000 target namespaces.
  2. After confirming replication has started, delete the source secret within a short period.
  3. Observe that the replicator completes the full replication process to all target namespaces before initiating deletion operations across those namespaces.

Expected behavior When a source secret is deleted shortly after creation, the replicator should ideally recognize and halt any pending or ongoing replication tasks and prioritize deletion across all target namespaces. This would optimize resource usage and reduce redundant operations.

Environment:

  • Kubernetes version: v1.30.5
  • kubernetes-replicator version: v2.10.2

Additional context n/a

kavishdahekar avatar Oct 30 '24 21:10 kavishdahekar