fix: serialize SecurityGroup ingress reconciles per SecurityGroup - #4890
fix: serialize SecurityGroup ingress reconciles per SecurityGroup#4890madvocate wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: madvocate The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
|
Welcome @madvocate! |
|
Hi @madvocate. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
b5b430b to
678c8b8
Compare
Concurrent reconciles of the same SecurityGroup each perform a non-atomic read-modify-write sequence: fetch the current rules, diff them against the desired permissions, then authorize/revoke. When two reconciles interleave, one can diff against a snapshot taken while the other was mid-mutation and revoke rules without granting replacements, leaving the SecurityGroup without any of the controller-managed rules. With the shared backend SecurityGroup feature this removes every ALB-to-target ingress rule on the cluster SecurityGroup at once, failing health checks and client traffic for all load balancers until the deferred TargetGroupBinding reconciler restores the rules (~30 minutes after a controller restart). Observed in production during Fargate maintenance: endpoint churn on the TargetGroupBinding defining the aggregated port-range boundary produced two concurrent reconciles; CloudTrail shows the controller authorizing tcp/3000-3008, revoking tcp/3000-8025, then 45 seconds later revoking tcp/3000-3008 again with no replacement grant. Serialize ReconcileIngress per SecurityGroup ID with a keyed mutex held across the fetch and the mutations, so every reconcile diffs against post-mutation state. Reconciles of different SecurityGroups are not serialized against each other.
678c8b8 to
d3b3cbf
Compare
Issue
#4889
Description
Checklist
README.md, or thedocsdirectory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯