Skip to content

OCPBUGS-87249 - clustermanager: re-evaluate egress IPs when cloud egress IP config changes - #3269

Open
jechen0648 wants to merge 1 commit into
openshift:mainfrom
jechen0648:egressipv6_assignment_fix
Open

OCPBUGS-87249 - clustermanager: re-evaluate egress IPs when cloud egress IP config changes#3269
jechen0648 wants to merge 1 commit into
openshift:mainfrom
jechen0648:egressipv6_assignment_fix

Conversation

@jechen0648

@jechen0648 jechen0648 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

📑 Description

Problem
On dualstack AWS clusters, egressIPv6 was never assigned even though nodes correctly report IPv6 subnet and capacity in the cloud.network.openshift.io/egress-ipconfig annotation.

The underlying cause lives in two places. The primary cause is in cloud-network-config-controller (CNCC): a bug in getSubnet could cause it to initially write the annotation with no IPv6 subnet (or the wrong one) by unconditionally picking the first entry in Ipv6CidrBlockAssociationSet regardless of its state. This is fixed in a companion CNCC PR.

However, even with the CNCC fix in place, there is a secondary failure mode in OVN-K's node UpdateResource handler. Consider this sequence:

A node comes up; CNCC has not yet annotated it, so initEgressIPAllocator fails. The node's egressIPConfig in the allocator cache has V6.Net == nil.
CNCC annotates the node (possibly with no IPv6 subnet initially, due to the CNCC bug).
OVN-K receives the node UPDATE, calls initEgressIPAllocator (cache updated), then hits the early-return guard:
if isOldReady == isNewReady && !isHostCIDRsAltered {
return nil // ← exits here; addEgressNode() is never called
}
Because only the CNCC annotation changed — not readiness and not host-cidrs — the handler returns early without calling addEgressNode().
Any EgressIPs whose IPv6 address could not be placed (no node had a matching V6.Net) remain permanently unassigned — addEgressNode() is the only code path that re-evaluates them.
Later, CNCC corrects the annotation (adding the IPv6 subnet). OVN-K again receives the UPDATE and again exits early, never reconsidering the unassigned IPv6 EgressIPs.
The net effect: even after both nodes report i.e. "ipv6":"2600:1f18:1816:ac01::/64" with capacity 14 in their annotation, the EgressIP status shows the IPv6 address as permanently unassigned.

Fix
pkg/util/node_annotations.go
Add CloudEgressIPConfigAnnotationChanged(), analogous to the existing NodeHostCIDRsAnnotationChanged()

pkg/clustermanager/egressip_event_handler.go
Add isCloudEgressIPConfigAltered to the early-return guard so that annotation changes from CNCC trigger addEgressNode(), giving previously-unassigned EgressIPs another chance to be reconciled with the updated node cache. A distinct log line is emitted when the trigger is an annotation change rather than a readiness transition.

Impact
Cloud platforms only (PlatformTypeIsEgressIPCloudProvider()): CloudEgressIPConfigAnnotationChanged only fires on nodes that CNCC manages, so bare-metal is unaffected.
Low frequency: CNCC typically writes the annotation once at node startup and rarely updates it, so addEgressNode() is not called more often than necessary.
No functional regression for IPv4: The change is additive — it only allows addEgressNode() to run in a case where it previously did not.

Related
Companion CNCC fix: [openshift/cloud-network-config-controller# ](openshift/cloud-network-config-controller#228) — fixes the root cause where getSubnet picks a stale disassociated IPv6 CIDR block association instead of the current associated one.

Testing
Pre-merge testing was performed with openshift/cloud-network-config-controller#228 on dualstack AWS IPv4 primary and dualstack AWS IPv6 primary cluster
Regression testing with openshift/cloud-network-config-controller#228 was performed on dualstack BM cluster

Fixes #

Additional Information for reviewers

✅ Checks

  • My code requires changes to the documentation
  • if so, I have updated the documentation as required
  • My code requires tests
  • if so, I have added and/or updated the tests as required
  • All the tests have passed in the CI

How to verify it

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of node updates so changes to cloud egress IP configuration are now recognized and reprocessed correctly.
    • Prevented updates from being skipped when only the cloud egress IP annotation changes.
    • Added clearer status logging during node re-evaluation, making it easier to understand why egress behavior is being recalculated.

…anges

When cloud-network-config-controller updates the
cloud.network.openshift.io/egress-ipconfig annotation (e.g., adding
an IPv6 subnet that was initially missing because the AWS subnet's
IPv6 CIDR block was not yet in 'associated' state), the node update
handler returned early without re-triggering egress IP assignment.

Add CloudEgressIPConfigAnnotationChanged() and include it in the
early-return guard so that addEgressNode() is called whenever the
annotation changes, allowing previously-unassigned IPv6 egress IPs
to be reconsidered.

Signed-off-by: Jean Chen <jechen@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Walkthrough

Node update reconciliation now treats cloud egress IP config annotation changes as meaningful. A new node annotation comparison helper feeds the egress IP event handler, which no longer short-circuits those updates and logs a different message before continuing.

Changes

Cloud egress IP annotation handling

Layer / File(s) Summary
Annotation comparison helper
go-controller/pkg/util/node_annotations.go
Adds CloudEgressIPConfigAnnotationChanged to compare the cloud egress IP config annotation between two nodes.
Update reconciliation uses annotation change
go-controller/pkg/clustermanager/egressip_event_handler.go
Checks the new helper result during node updates, keeps cloud-annotation changes from early return, and switches the ready-and-reachable log message before continuing reconciliation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I twitch my nose, the nodes now speak,
Cloud egress changes make me peek.
No early hop when annotations sway,
I bound through reconciling, bright as day.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: re-evaluating egress IPs when cloud egress IP config changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from kyrtapz and martinkennelly June 26, 2026 19:32
@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jechen0648
Once this PR has been reviewed and has the lgtm label, please assign knobunc for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jechen0648

jechen0648 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jechen0648

Copy link
Copy Markdown
Contributor Author

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@jechen0648

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@jechen0648 jechen0648 changed the title [WIP]OCPBUGS-87249 - clustermanager: re-evaluate egress IPs when cloud egress IP config changes OCPBUGS-87249 - clustermanager: re-evaluate egress IPs when cloud egress IP config changes Jul 6, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 6, 2026
@jechen0648

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@sadasu: This PR was included in a payload test run from openshift/cloud-network-config-controller#228
trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-ovn-installer-dualstack-ipv6-primary-techpreview

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/91d917a0-8087-11f1-886f-7fdbe052f05d-0

@sadasu

sadasu commented Aug 4, 2026

Copy link
Copy Markdown

/retest

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@jechen0648: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw 2245bce link true /test e2e-metal-ipi-ovn-dualstack-bgp-local-gw
ci/prow/e2e-metal-ipi-ovn-dualstack 2245bce link true /test e2e-metal-ipi-ovn-dualstack
ci/prow/e2e-aws-ovn-fdp-qe 2245bce link true /test e2e-aws-ovn-fdp-qe
ci/prow/e2e-gcp-ovn 2245bce link true /test e2e-gcp-ovn
ci/prow/e2e-metal-ipi-ovn-dualstack-bgp 2245bce link true /test e2e-metal-ipi-ovn-dualstack-bgp
ci/prow/5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade 2245bce link true /test 5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade

Full PR test history. Your PR dashboard.

Details

Instructions 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. I understand the commands that are listed here.

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@sadasu: This PR was included in a payload test run from openshift/cloud-network-config-controller#228
trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-aws-ovn-installer-dualstack-ipv6-primary-techpreview

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/aaa99e80-90d6-11f1-9bba-3026d0a99078-0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants