Skip to content

[WIP]OCPBUGS-87249: on AWS, select associated IPv6 CIDR block for egress IP subnet#228

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

[WIP]OCPBUGS-87249: on AWS, select associated IPv6 CIDR block for egress IP subnet#228
jechen0648 wants to merge 1 commit into
openshift:mainfrom
jechen0648:egressipv6_assignment_on_aws

Conversation

@jechen0648

Copy link
Copy Markdown

On dualstack IPv4-primary AWS clusters, egressIPv6 addresses are never assigned to egress nodes even though the nodes report non-zero IPv6 capacity in their cloud.network.openshift.io/egress-ipconfig annotation.

The root cause is in getSubnet (pkg/cloudprovider/aws.go). AWS represents an IPv6 CIDR block association on a subnet through Ipv6CidrBlockAssociationSet, and each entry carries a state (associating, associated, disassociated, etc.). A subnet can accumulate multiple entries over its lifetime — for example, after an IPv6 CIDR block is replaced, the old entry stays in the list as disassociated ahead of the new associated entry.

The previous code unconditionally picked Ipv6CidrBlockAssociationSet[0] without checking state, if the first entry is stale (disassociated), one of two things goes wrong:

Wrong CIDR returned — the old, now-disassociated IPv6 CIDR is used as the node's IPv6 subnet in the annotation. OVN-Kubernetes stores this and then cannot find a node whose subnet contains the egress IPv6 address (which is from the current, correct CIDR), so it never assigns the EgressIP.
No CIDR returned — if the first entry has an empty Ipv6CidrBlock, the condition fails and v6Subnet stays nil. The annotation lacks an IPv6 subnet entirely and OVN-Kubernetes concludes the node has no IPv6 egress capability.
In both cases, no CloudPrivateIPConfig is ever created for the IPv6 EgressIP, so CNCC is never asked to assign it.

Fix
Iterate through all entries in Ipv6CidrBlockAssociationSet and select the first one whose state is associated.

Two minor cleanups are included in the same change:

The empty-subnet guard is tightened from len > 1 to len != 1 so that a DescribeSubnets response returning zero subnets is also caught.
The IPv4 parsing block is cleaned up to avoid shadowing the outer subnet variable (_, v4Net, err instead of _, subnet, err).

Testing

Related
A companion fix in openshift/ovn-kubernetes ensures OVN-Kubernetes re-evaluates unassigned EgressIPs when the cloud.network.openshift.io/egress-ipconfig annotation changes, so that any cluster where the annotation was previously incorrect (e.g., missing IPv6 subnet) gets healed automatically once CNCC updates it.

…ess IP subnet

On dualstack AWS clusters, a subnet's Ipv6CidrBlockAssociationSet can
contain multiple entries when an IPv6 CIDR block has been replaced
(e.g., a stale 'disassociated' entry followed by the current
'associated' one). The previous code unconditionally picked [0],
which could return the wrong CIDR or no CIDR at all, causing the
egress-ipconfig annotation to lack the IPv6 subnet. OVN-Kubernetes
would then have no node eligible to host the IPv6 egress IP.

Fix by iterating through all associations and selecting the first one
in 'associated' state.

Signed-off-by: Jean Chen <jechen@redhat.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
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 26, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@jechen0648: This pull request references Jira Issue OCPBUGS-87249, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

On dualstack IPv4-primary AWS clusters, egressIPv6 addresses are never assigned to egress nodes even though the nodes report non-zero IPv6 capacity in their cloud.network.openshift.io/egress-ipconfig annotation.

The root cause is in getSubnet (pkg/cloudprovider/aws.go). AWS represents an IPv6 CIDR block association on a subnet through Ipv6CidrBlockAssociationSet, and each entry carries a state (associating, associated, disassociated, etc.). A subnet can accumulate multiple entries over its lifetime — for example, after an IPv6 CIDR block is replaced, the old entry stays in the list as disassociated ahead of the new associated entry.

The previous code unconditionally picked Ipv6CidrBlockAssociationSet[0] without checking state, if the first entry is stale (disassociated), one of two things goes wrong:

Wrong CIDR returned — the old, now-disassociated IPv6 CIDR is used as the node's IPv6 subnet in the annotation. OVN-Kubernetes stores this and then cannot find a node whose subnet contains the egress IPv6 address (which is from the current, correct CIDR), so it never assigns the EgressIP.
No CIDR returned — if the first entry has an empty Ipv6CidrBlock, the condition fails and v6Subnet stays nil. The annotation lacks an IPv6 subnet entirely and OVN-Kubernetes concludes the node has no IPv6 egress capability.
In both cases, no CloudPrivateIPConfig is ever created for the IPv6 EgressIP, so CNCC is never asked to assign it.

Fix
Iterate through all entries in Ipv6CidrBlockAssociationSet and select the first one whose state is associated.

Two minor cleanups are included in the same change:

The empty-subnet guard is tightened from len > 1 to len != 1 so that a DescribeSubnets response returning zero subnets is also caught.
The IPv4 parsing block is cleaned up to avoid shadowing the outer subnet variable (_, v4Net, err instead of _, subnet, err).

Testing

Related
A companion fix in openshift/ovn-kubernetes ensures OVN-Kubernetes re-evaluates unassigned EgressIPs when the cloud.network.openshift.io/egress-ipconfig annotation changes, so that any cluster where the annotation was previously incorrect (e.g., missing IPv6 subnet) gets healed automatically once CNCC updates it.

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Ignore keyword(s) in the title.

⛔ Ignored keywords (2)
  • WIP
  • DNM

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e0454e50-5e57-4611-9d55-a424125447ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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 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 tssurya 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

@openshift-ci

openshift-ci Bot commented Jun 26, 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/hypershift-e2e-aks 1568129 link true /test hypershift-e2e-aks
ci/prow/e2e-aws-ovn 1568129 link true /test e2e-aws-ovn
ci/prow/security 1568129 link false /test security

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.

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants