← Back to Pull requests

[octavia-ingress-controller] Fix lost update race conditions in SG add/remove on LB ports #3247

Open
unknown opened this pull request with 216 lines diff across 2 files
View on GitHub
unknown unknown commented on Oct 11, 2026 17:34 UTC
Author

What this PR does / why we need it:

Neutron doesn't let you add or remove just one security group from a port. The
only option is to send the full list of security groups you want the port to
have. So to add one, we read the port's current list, add our SG to it, and
write the whole list back.

The problem is the gap between the read and the write. If anything else changes
the port's security groups in that gap, we don't see it, our write is based on
the old list, so it overwrites (and loses) their change. No error is raised; the
update just silently disappears.

  • This fixes the race in both the add (applyNodeSecurityGroupIDForLB) and remove

  • (disassociateSecurityGroupForLB) paths by:
  • re-reading the port immediately before updating, inside a retry loop, so each

  • attempt works from fresh state;
  • setting revision_number on the update so Neutron's revision-if-match

  • extension rejects the write if the port changed underneath us;
  • retrying on the resulting RevisionNumberConstraintFailed conflict via

  • retry.RetryOnConflict, re-reading each time.
  • The shared get/update/retry logic lives in a new updatePortSecurityGroups helper function.
  • Which issue this PR fixes(if applicable):

    Fixes https://github.com/kubernetes/cloud-provider-openstack/issues/2630

    Release note:

    ``release-note
    NONE
    ``

    Special notes for reviewers:: This is based on the work done by @stephenfin previously in the PR #2631. This PR aims to add the retry handling, following the pattern @dulek referenced in openshift/cloud-network-config-controller.

    Diff: 216 lines (+162 / -54) across 2 files Reviewer: dulek Review duration: 71780m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.44) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.44 · 216 lines diff across 2 files
    0.44
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.322
    Real PR Conversation Timeline
    1 comments
    "Review active on #3247"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.6% (MEDIUM) · Higher = larger blast radius
    43.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.1% · Safe to merge
    24.1%