Skip to content

Conversation

@NihaNallappagari
Copy link
Contributor

@NihaNallappagari NihaNallappagari commented May 13, 2025

Reason for Change:
Current Problem:
VNET currently limits scaling to 64K IP addresses per VNET due to per-IP route mappings. To support larger AKS clusters, the platform is introducing per-prefix (CIDR) route mapping, allowing a single mapping to represent multiple IPs (e.g., /24 enables 256 IPs per mapping). This enables scaling up to 16 million IPs per VNET without impacting the underlying platform.

Change needed:
Prefix on NIC v4 is supported in Swiftv1, but Swiftv1 does not support IPv6. This change upgrades Prefix on NIC v4 functionality to Swiftv2 and introduces IPv6 support in Swiftv2.

Changes
This PR has changes specific to Prefix on NICv6
CNS
--Consuming PrimaryIPv6, GatewayIPv6, MacAddress (DelegatedNIC) from NNC CRD because of dualstack NC
--IP allocation: Assign IPs of each IPFamily as part of RequestIPs api request (Currently when a pod is created, IPAM RequestsIPs from CNS where CNS picks one IP from each NC and hands it over to IPAM.

IPAM
--Change RequestIPs response parsing to read GatewayIPv6 and MacAddress
--Populates Interfaces with MacAddress which is used by CNI to plumb routes to send traffic

Design doc for pocv6 with sample NNC
Requirements:

Notes:

Copilot AI review requested due to automatic review settings May 13, 2025 22:54
@NihaNallappagari NihaNallappagari requested review from a team as code owners May 13, 2025 22:54
@NihaNallappagari NihaNallappagari requested a review from csfmomo May 13, 2025 22:54

This comment was marked as outdated.

@NihaNallappagari
Copy link
Contributor Author

NihaNallappagari commented May 13, 2025

@microsoft-github-policy-service agree company="Microsoft"

@tamilmani1989
Copy link
Member

@rbtr can you review this as well since it touches cns changes for aks swift too

@rbtr rbtr requested a review from Copilot June 6, 2025 15:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces changes to support dual-stack NIC functionality for Prefix on NICv6 scenarios by extending both CNS and IPAM components. Key updates include:

  • CNS: Populating the MACAddress in podIPInfo and skipping NC version sync when a MAC address is present.
  • IPAM: Adjusting IP allocation logic by mapping and handling multiple IP families and updating error messages accordingly.
  • Additional updates in tests, internal API, conversion, network container contract, and Azure IPAM integration to support IPv6 gateway addresses and related deduplication.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cns/restserver/util.go Added MACAddress population to podIPInfo
cns/restserver/ipam.go Adjusted IP assignment logic for dual-stack handling and introduced generateAssignedIPKey
cns/restserver/internalapi_test.go Added test to verify skipping NC version sync for prefix on NIC swift v2
cns/restserver/internalapi_linux.go Added IPv4 check in SNAT rule programming
cns/restserver/internalapi.go Skips sync for prefix on NIC when MAC address is set
cns/kubecontroller/nodenetworkconfig/conversion_linux.go Updated static NC request conversion to handle single IP prefix cases properly
cns/NetworkContainerContract.go Added IPv6 gateway field and IPFamily enum definition
azure-ipam/ipconfig/ipconfig.go Updated response processing to include IPv6 gateway parsing
azure-ipam/ipam.go Modified CmdAdd to integrate IPv6 gateway assignment and deduplicate interfaces
Comments suppressed due to low confidence (2)

cns/restserver/ipam.go:1029

  • Consider adding an inline comment to clarify why the slice size for podIPInfo is set to the number of IP families, emphasizing how dual-stack handling determines the number of IPs to assign.
numberOfIPs = numOfIPFamilies

azure-ipam/ipam.go:150

  • [nitpick] Consider adding a comment explaining that the deduplication of interfaces by MAC address is deliberate to avoid duplicate interface entries when multiple IP family entries point to the same network interface.
if podIPInfo.MacAddress == "" || seenInterfaces[podIPInfo.MacAddress] {

Copy link
Collaborator

@rbtr rbtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there AzCNI changes I'm missing here or is this only for Cilium?

@NihaNallappagari NihaNallappagari force-pushed the prefixOnNicv6Support branch 2 times, most recently from 85118ff to 14d0336 Compare June 26, 2025 15:46
@NihaNallappagari
Copy link
Contributor Author

NihaNallappagari commented Jun 30, 2025

are there AzCNI changes I'm missing here or is this only for Cilium?

The changes are related to only Cilium, no azure cni changes made

@NihaNallappagari NihaNallappagari force-pushed the prefixOnNicv6Support branch 2 times, most recently from b132f7b to 14aa47b Compare July 7, 2025 16:08
@github-actions github-actions bot added the stale Stale due to inactivity. label Jul 22, 2025
@Azure Azure deleted a comment from github-actions bot Jul 28, 2025
@github-actions github-actions bot removed the stale Stale due to inactivity. label Jul 29, 2025
tamilmani1989
tamilmani1989 previously approved these changes Aug 6, 2025
@github-actions
Copy link

github-actions bot commented Sep 4, 2025

This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale due to inactivity. label Sep 4, 2025
@NihaNallappagari
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@NihaNallappagari NihaNallappagari marked this pull request as ready for review September 17, 2025 20:08
@NihaNallappagari NihaNallappagari force-pushed the prefixOnNicv6Support branch 2 times, most recently from 4c2c741 to a875692 Compare September 18, 2025 12:40
@NihaNallappagari
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@NihaNallappagari
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Azure Azure deleted a comment from nihanMicrosoft Sep 29, 2025
@Azure Azure deleted a comment from azure-pipelines bot Sep 29, 2025
@NihaNallappagari NihaNallappagari added this pull request to the merge queue Sep 29, 2025
Merged via the queue into Azure:master with commit a1550f2 Sep 29, 2025
101 of 102 checks passed
@NihaNallappagari NihaNallappagari deleted the prefixOnNicv6Support branch September 29, 2025 22:37
NihaNallappagari added a commit to NihaNallappagari/azure-container-networking that referenced this pull request Oct 3, 2025
* Prefix on NIC v6 support

* update dedup comment in ipam

* add log for a gatway error scenario

* handle synchostversion sync on pon swiftv2 nic

* handle gatewayip parse failure or nil scenario

* remove unused code

Address PR comments

remove unnecessary logger

update synhost skip test scenario

fix linting error

updated lint error

fix linting error

.

update synhost skip test scenario

fix linting error

updated lint error

fix linting error

.

* add test scenario

* update test to handle gatway nil case

* remove synchost skip and single ip skip

.

.

* Add missing test scenarios

* fix ipam_test conflicts

* fix conflits

small fixes

fix lint errors

lint fix

.

Delete examples/imds_nc_lookup.go

Signed-off-by: NihaNallappagari <[email protected]>

fix lint

.

* fix linting

* add todo and remove multiple interface scenario

* Skip add primary ip's to secondary config for swiftv2 pon scenarios

fix lint error

.

* code review comment

* Update gateway ipv6 to use default value, that auto detects and adds to neigh table

* remove unwanted changes

* address ipfamily comment

* fix test failure

* Handle nilgateway scenario

* remove unnedded else block

* comments changes

---------

Co-authored-by: Kaushik Vuligonda <[email protected]>
Co-authored-by: nn052161 <[email protected]>
NihaNallappagari added a commit to NihaNallappagari/azure-container-networking that referenced this pull request Oct 9, 2025
* Prefix on NIC v6 support

* update dedup comment in ipam

* add log for a gatway error scenario

* handle synchostversion sync on pon swiftv2 nic

* handle gatewayip parse failure or nil scenario

* remove unused code

Address PR comments

remove unnecessary logger

update synhost skip test scenario

fix linting error

updated lint error

fix linting error

.

update synhost skip test scenario

fix linting error

updated lint error

fix linting error

.

* add test scenario

* update test to handle gatway nil case

* remove synchost skip and single ip skip

.

.

* Add missing test scenarios

* fix ipam_test conflicts

* fix conflits

small fixes

fix lint errors

lint fix

.

Delete examples/imds_nc_lookup.go

Signed-off-by: NihaNallappagari <[email protected]>

fix lint

.

* fix linting

* add todo and remove multiple interface scenario

* Skip add primary ip's to secondary config for swiftv2 pon scenarios

fix lint error

.

* code review comment

* Update gateway ipv6 to use default value, that auto detects and adds to neigh table

* remove unwanted changes

* address ipfamily comment

* fix test failure

* Handle nilgateway scenario

* remove unnedded else block

* comments changes

---------

Co-authored-by: Kaushik Vuligonda <[email protected]>
Co-authored-by: nn052161 <[email protected]>
sivakami-projects pushed a commit that referenced this pull request Oct 23, 2025
* Prefix on NIC v6 support

* update dedup comment in ipam

* add log for a gatway error scenario

* handle synchostversion sync on pon swiftv2 nic

* handle gatewayip parse failure or nil scenario

* remove unused code

Address PR comments

remove unnecessary logger

update synhost skip test scenario

fix linting error

updated lint error

fix linting error

.

update synhost skip test scenario

fix linting error

updated lint error

fix linting error

.

* add test scenario

* update test to handle gatway nil case

* remove synchost skip and single ip skip

.

.

* Add missing test scenarios

* fix ipam_test conflicts

* fix conflits

small fixes

fix lint errors

lint fix

.

Delete examples/imds_nc_lookup.go

Signed-off-by: NihaNallappagari <[email protected]>

fix lint

.

* fix linting

* add todo and remove multiple interface scenario

* Skip add primary ip's to secondary config for swiftv2 pon scenarios

fix lint error

.

* code review comment

* Update gateway ipv6 to use default value, that auto detects and adds to neigh table

* remove unwanted changes

* address ipfamily comment

* fix test failure

* Handle nilgateway scenario

* remove unnedded else block

* comments changes

---------

Co-authored-by: Kaushik Vuligonda <[email protected]>
Co-authored-by: nn052161 <[email protected]>
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.

5 participants