Skip to content

fix: subnet auto-discovery to IPv6-capable subnets for dualstack ip address type - #4865

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
jupdec:fix-4852-dualstack-subnet-discovery
Jul 31, 2026
Merged

kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
jupdec:fix-4852-dualstack-subnet-discovery

Conversation

@jupdec

@jupdec jupdec commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Issue

Fixes #4852

Description

Subnet auto-discovery never received the load balancer's ipAddressType, so nothing checked Ipv6CidrBlockAssociationSet. A dualstack LB relying on discovery could be handed subnets with no IPv6 CIDR, and ELBv2 rejected the create call with:

    ValidationError: You must specify subnets with an associated IPv6 CIDR block.

Being a shared resolver defect, this affected ALB Ingress, NLB Services, the Ingress frontend-NLB feature and Gateway alike.

Thread ipAddressType to the resolver via a new WithSubnetsResolveLBIPAddressType option and apply the missing criterion:

  • discovery skips subnets without an associated IPv6 CIDR, and reports how many were skipped when none remain eligible.
  • explicitly specified subnets fail up front with an error naming the offending subnets, instead of the opaque ELBv2 error.

IPv4 load balancers are unaffected and their failure message is unchanged. An IPv6 CIDR must be in the "associated" state to count.

Case1: When VPC has subnets with Ipv6 CIDRs, if ALB/NLB ip address type is dualstack auto subnet discovery resolves successfully

Normal  SuccessfullyReconciled  23s  ingress  Successfully reconciled

  NAME                     CLASS               ADDRESS                                                                   PORTS
  verify-happy-discovery   repro-subnet-disc   k8s-reprosub-verifyha-b7c819922a-1258703918.us-west-2.elb.amazonaws.com   80

  Confirmed in ELBv2 that the LB was created dualstack on the three IPv6-enabled subnets:

  {
    "Name": "k8s-reprosub-verifyha-b7c819922a",
    "IpType": "dualstack",
    "Scheme": "internet-facing",
    "Subnets": ["subnet-00a488ef08f1a058e", "subnet-0e4fb36588a3fc481", "subnet-0fde0bb80a7b0b487"]
  }

Case2: When no subnets have any Ipv6 CIDRs available, error logging bubbles up this message

  • Before: FailedDeployModel — an ValidationError from a wasted ELBv2 CreateLoadBalancer API call.
  • After: FailedBuildModel — the controller stops at model-build time, never calls AWS, and explains exactly why:
Warning  FailedBuildModel  11s (x13 over 33s)  ingress  Failed build model due to couldn't auto-discover subnets: unable to resolve at least one subnet. Evaluated 3 subnets: 0 are tagged for
  other clusters, 0 have insufficient available IP addresses, and 3 don't have an associated IPv6 CIDR block, which is required for dualstack load balancers

Case3: When subnets are explicitly specified and none have Ipv6 CIDRs, validation fails early naming the offending subnets

  • Before: FailedDeployModel — an ValidationError from a wasted ELBv2 CreateLoadBalancer API call.
  • After: FailedBuildModel — the controller stops at model-build time, never calls AWS, and explains exactly why:
  Warning  FailedBuildModel  13s (x13 over 34s)  ingress  Failed build model due to subnets [subnet-0c5ac0d06bdcd265f subnet-0af082802adb73f72 subnet-0a1282ceff5e63623] do not have an associated
  IPv6 CIDR block, which is required for dualstack load balancers

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@kubernetes-prow kubernetes-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. labels Jul 29, 2026
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 29, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @jupdec. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 29, 2026
@shraddhabang

Copy link
Copy Markdown
Collaborator

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 29, 2026
@jupdec
jupdec marked this pull request as ready for review July 29, 2026 19:53
@kubernetes-prow kubernetes-prow 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 29, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from shuqz and zac-nixon July 29, 2026 19:53
@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2026
@shraddhabang

Copy link
Copy Markdown
Collaborator

/retest

@shraddhabang

Copy link
Copy Markdown
Collaborator

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 30, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jupdec, shraddhabang, wweiwei-li

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [shraddhabang,wweiwei-li]

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

@shraddhabang

Copy link
Copy Markdown
Collaborator

/approved

@jupdec
jupdec force-pushed the fix-4852-dualstack-subnet-discovery branch from be07133 to c87e16e Compare July 31, 2026 16:47
@kubernetes-prow kubernetes-prow Bot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. labels Jul 31, 2026
@shraddhabang

Copy link
Copy Markdown
Collaborator

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 31, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit f2ca734 into kubernetes-sigs:main Jul 31, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subnet auto-discovery ignores ip-address-type: dualstack, returns subnets without an IPv6 CIDR → CreateLoadBalancer fails

3 participants