feat/ces: Empty CES before deletion
The Issue & Context
When CiliumEndpointSlices with many endpoints were deleted, Kubernetes watch DELETED events sent the full stale endpoint list to all nodes, causing large network overhead during bulk deletes or scale-downs.
Root Cause Analysis
The operator deleted CES resources directly without first clearing their endpoints, so the final DELETED watch event carried the full, already-stale endpoint list. This was due to the lack of an intermediate update clearing the endpoints before deletion in the reconciler logic.
Solution Strategy & Architectural Pattern
Introduced a new operator flag to detect CES with endpoint counts above a threshold and update them with an empty endpoints list before issuing the DELETE. This causes nodes to receive a small MODIFIED event with empty endpoints, followed by a small DELETED event, allowing them to process endpoint removals incrementally and reduce watch payload sizes significantly.
Key Takeaway for Contributors
For large-scale resource deletions in Kubernetes, inserting an intermediate update that clears heavy fields before deletion can drastically reduce watch event payloads and improve cluster scalability.