Skip to content

Conversation

@rahulait
Copy link
Contributor

@rahulait rahulait commented Apr 4, 2025

General:

This PR enables ipv6 ipam allocation to nodes. If CCM is started with --allocate-node-cidrs, it will allocate both ipv4 and ipv6 pod CIDRs to nodes.

This PR adds IPv6 IP Address Management (IPAM) support to the cloud controller manager by extending the node IPAM allocator to compute and assign unique /112 IPv6 ranges from each node’s /64, updating Linode client interfaces and tests accordingly.

Introduce a new cloud/nodeipam controller and ipam package that allocates both IPv4 and IPv6 PodCIDRs.
Extend Linode client API (ListInstanceConfigs) and update mocks, metrics, and go.mod deps to support IPv6 range retrieval.
Update the Linode-specific nodeipamcontroller to pass IPv6 mask defaults and enforce only one IPv4 cluster CIDR.

Note
In this PR, we are adding a function to calculate unique /112 ipv6 cidr range for each node from the /64 cidr allocated to it. Dependencies for starting CCM with --allocate-node-cidrs flag:

  1. CCM must be running within the VPC or the linodes should have ipv6 ranges configured on their interfaces.
  2. VPC must be configured to have ipv6 range allocated. Subnet to which linode is attached should also have ipv6 range allocated. Linode must request for auto-allocation of ipv6 range to get an ipv6 range configured on its interface.
  3. We currently support legacy interfaces. We will add support for newer interfaces in future PRs.

To disable ipv6 allocation logic, one can specify --disable-ipv6-node-cidr-allocation=true to just use ipv4 allocation.

Sample CAPL PR which does the same: linode/cluster-api-provider-linode#773

  • Have you removed all sensitive information, including but not limited to access keys and passwords?
  • Have you checked to ensure there aren't other open or closed Pull Requests for the same bug/feature/question?

Pull Request Guidelines:

  1. Does your submission pass tests?
  2. Have you added tests?
  3. Are you addressing a single feature in this PR?
  4. Are your commits atomic, addressing one change per commit?
  5. Are you following the conventions of the language?
  6. Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. Have you explained your rationale for why this feature is needed?
  8. Have you linked your PR to an open issue

@github-actions github-actions bot added the new-feature for new features in the changelog. label Apr 4, 2025
@codecov
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

Attention: Patch coverage is 51.48936% with 228 lines in your changes missing coverage. Please review.

Project coverage is 72.44%. Comparing base (f1b64ce) to head (2ca8173).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cloud/nodeipam/ipam/cloud_allocator.go 46.24% 154 Missing and 32 partials ⚠️
cloud/nodeipam/node_ipam_controller.go 63.93% 17 Missing and 5 partials ⚠️
cloud/nodeipam/ipam/cidr_allocator.go 60.86% 15 Missing and 3 partials ⚠️
cloud/linode/nodeipamcontroller.go 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #369      +/-   ##
==========================================
- Coverage   75.83%   72.44%   -3.40%     
==========================================
  Files          16       19       +3     
  Lines        3054     3498     +444     
==========================================
+ Hits         2316     2534     +218     
- Misses        547      733     +186     
- Partials      191      231      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • go.mod: Language not supported

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.

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • go.mod: Language not supported
Comments suppressed due to low confidence (1)

cloud/linode/nodeipamcontroller.go:45

  • The default IPv6 node CIDR mask size has been changed from 64 to 112. Please confirm that this new value aligns with the desired network design and update any related documentation if necessary.
defaultNodeMaskCIDRIPv6 = 112

@rahulait rahulait requested a review from Copilot April 7, 2025 14:43
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.

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • go.mod: Language not supported

@rahulait rahulait requested a review from Copilot April 7, 2025 16:07

This comment was marked as outdated.

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 adds IPv6 IP Address Management (IPAM) support to the cloud controller manager, enabling it to allocate both IPv4 and IPv6 pod CIDRs to nodes when started with the --allocate-node-cidrs flag. The implementation creates a new node IPAM controller that calculates unique /112 IPv6 ranges from each node's /64 range and extends the Linode client to retrieve IPv6 configurations.

Key changes:

  • Introduction of a new cloud/nodeipam controller and ipam package for dual-stack CIDR allocation
  • Extension of Linode client API with ListInstanceConfigs method to retrieve IPv6 range information
  • Addition of configuration flag to optionally disable IPv6 allocation

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
main.go Adds new command-line flag for disabling IPv6 node CIDR allocation
go.mod Updates linodego dependency and adds required indirect dependencies
docs/configuration/nodeipam.md Updates documentation to reflect IPv6 support and new default mask size
docs/configuration/environment.md Documents new IPv6 disable flag
deploy/chart/values.yaml Adds Helm chart value for IPv6 disable option
deploy/chart/templates/daemonset.yaml Adds conditional flag to daemonset template
cloud/nodeipam/ New controller package implementing dual-stack IPAM functionality
cloud/nodeipam/ipam/ Core IPAM logic with cloud allocator for Linode-specific IPv6 allocation
cloud/linode/nodeipamcontroller.go Linode-specific node IPAM controller configuration
cloud/linode/client/ Extends client interface with ListInstanceConfigs method for IPv6 retrieval
Makefile Updates test coverage to include new nodeipam packages
Comments suppressed due to low confidence (1)

cloud/nodeipam/ipam/cloud_allocator.go:360

  • [nitpick] Variable name 'ipv6Range' should follow Go naming conventions and be 'ipv6Range' or better yet 'ipv6RangeStr' to indicate it's a string representation.
	if ipv6Range == "" {

@rahulait rahulait merged commit b0bf52f into main Jul 23, 2025
10 of 14 checks passed
@AshleyDumaine AshleyDumaine deleted the add-ipv6-ipam-support branch October 15, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants