Skip to content

[feat] : allocate ipv6 /64 cidrs to linodes#773

Merged
rahulait merged 6 commits into
mainfrom
ipv6-test
Jul 17, 2025
Merged

[feat] : allocate ipv6 /64 cidrs to linodes#773
rahulait merged 6 commits into
mainfrom
ipv6-test

Conversation

@rahulait

@rahulait rahulait commented Jun 18, 2025

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
NOTE: This uses a beta feature which is not yet available in production. Once the supported APIs are enabled in production, this feature can be used. IPv6 range allocation is disabled by default and can be enabled on request.

This PR will enable linodes to get a /64 ipv6 cidr allocated to them by linode API. It adds IPv6 /64 CIDR allocation support to Linode VPCs by extending API types, validation, controller logic, and documentation.

The PR does:

  • Introduce IPv6 and IPv6Range fields in LinodeVPCSpec and VPCSubnetCreateOptions, with CRD schema and deepcopy support.
  • Implement validateIPv6Range in the webhook to enforce correct /prefix or auto values, and add corresponding tests.
  • Extend controller helpers and machine interface configuration to propagate allocated IPv6 ranges into VPCs, subnets, and instance interfaces; update tests and bump linodego dependency.
  • Add documentation snippets for the new fields in docs/src/reference/out.md

ipv6 CIDRs are allocated to VPCs, subnets within VPCs and then to linodes attached to subnets which have ipv6 cidr ranges.

Following config (ipv6Range) can be added to LinodeVPC and its subnets to have ipv6 ranges allocated to VPC:

---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
kind: LinodeVPC
metadata:
  labels:
    cluster.x-k8s.io/cluster-name: rs-test2
  name: rs-test2
  namespace: default
spec:
  credentialsRef:
    name: rs-test2-credentials
  region: us-east
  ipv6Range:
  - range: auto
  subnets:
  - ipv4: 10.0.0.0/8
    label: default
    ipv6Range:
    - range: auto

Instead of "auto", one can also specify the prefix length preceded by "/" ( like "/52").
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@codecov

codecov Bot commented Jul 16, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 86.15385% with 18 lines in your changes missing coverage. Please review.

Project coverage is 63.16%. Comparing base (b3e7cbb) to head (c060552).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nternal/controller/linodevpc_controller_helpers.go 58.13% 14 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #773      +/-   ##
==========================================
+ Coverage   62.83%   63.16%   +0.33%     
==========================================
  Files          71       71              
  Lines        7178     7292     +114     
==========================================
+ Hits         4510     4606      +96     
- Misses       2401     2415      +14     
- Partials      267      271       +4     

☔ 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.

@rahulait rahulait marked this pull request as ready for review July 16, 2025 04:30
@rahulait rahulait changed the title [WIP][feat] : allocate ipv6 /64 cidrs to linodes [feat] : allocate ipv6 /64 cidrs to linodes Jul 16, 2025

This comment was marked as outdated.

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

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 support for allocating IPv6 /64 CIDRs to Linodes by introducing ipv6Range fields for VPCs and subnets, validating their format in webhooks, and propagating the allocated ranges through controllers and instance configurations.

  • Define new IPv6Range and IPv6 fields in the LinodeVPC and subnet specs/types, with generated deep-copy methods.
  • Extend webhook validation (validateIPv6Range) and add unit tests for correct/incorrect IPv6 range formats.
  • Update controller helpers and machine interface logic to reconcile, create, and apply actual IPv6 ranges, plus corresponding test and documentation updates.

Reviewed Changes

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

Show a summary per file
File Description
internal/webhook/v1alpha2/linodevpc_webhook.go Added validateIPv6Range function and invoked it for VPC & subnets
internal/webhook/v1alpha2/linodevpc_webhook_test.go New unit tests covering valid and invalid IPv6Range values
internal/controller/linodevpc_controller_helpers.go Populate Spec.IPv6 from API responses and map IPv6Range to create options
internal/controller/linodemachine_controller_helpers.go Generate IPv6 interface config based on subnet ranges
api/v1alpha2/linodevpc_types.go & zz_generated.deepcopy.go Introduce VPCCreateOptionsIPv6, VPCSubnetCreateOptionsIPv6, and new spec fields
config/crd/bases/..._linodevpcs.yaml Extend CRD schema with ipv6 and ipv6Range fields
docs/src/reference/out.md Add reference docs for ipv6 and ipv6Range in VPC and subnets
go.mod Bump linodego dependency to version supporting IPv6 ranges
Comments suppressed due to low confidence (1)

config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml:85

  • [nitpick] Consider adding an OpenAPI validation (e.g., a regex pattern or x-kubernetes-validations) for the ipv6Range field to enforce the '/' or 'auto' format at the API level, instead of relying solely on the webhook.
              ipv6Range:

Comment thread internal/controller/linodemachine_controller_helpers.go
Comment thread internal/controller/linodevpc_controller_helpers.go Outdated
Comment thread go.mod
Comment thread internal/webhook/v1alpha2/linodevpc_webhook_test.go

This comment was marked as outdated.

@rahulait rahulait requested a review from Copilot July 17, 2025 05:49

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Adds IPv6 /64 CIDR allocation support to Linode VPCs by extending API types, validation, controller logic, and documentation.

  • Introduce IPv6 and IPv6Range fields in LinodeVPCSpec and VPCSubnetCreateOptions, with CRD schema and deepcopy support.
  • Implement validateIPv6Range in the webhook to enforce correct /prefix or auto values, and add corresponding tests.
  • Extend controller helpers and machine interface configuration to propagate allocated IPv6 ranges into VPCs, subnets, and instance interfaces; update tests and bump linodego dependency.
  • Add documentation snippets for the new fields in docs/src/reference/out.md.

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/webhook/v1alpha2/linodevpc_webhook_test.go Added test cases for invalid and valid IPv6Range values
internal/webhook/v1alpha2/linodevpc_webhook.go Added validateIPv6Range and wired IPv6Range validation
internal/controller/linodevpc_controller_helpers.go Refactored reconciliation to set IPv6 in VPC and subnets
internal/controller/linodevpc_controller_test.go Updated VPC lifecycle tests to assert IPv6 ranges
internal/controller/linodemachine_controller_helpers.go Inject IPv6 ranges into machine interface config
internal/controller/linodemachine_controller_helpers_test.go Added tests for IPv6 in interface configuration
api/v1alpha2/linodevpc_types.go Defined IPv6 and IPv6Range fields in API types
api/v1alpha2/zz_generated.deepcopy.go Generated deepcopy methods for new IPv6-related types
config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml Extended CRD schema with IPv6 and IPv6Range properties
docs/src/reference/out.md Documented new IPv6 and IPv6Range fields in reference docs
go.mod Bumped github.com/linode/linodego to include IPv6 support
Comments suppressed due to low confidence (2)

docs/src/reference/out.md:1082

  • [nitpick] Add a note in the Default column clarifying that omitting ipv6Range results in no IPv6 allocation (or defaults to 'auto' behavior if intended) to help users understand the default behavior.
| `ipv6Range` _[VPCCreateOptionsIPv6](#vpccreateoptionsipv6) array_ | IPv6Range is a list of IPv6 ranges to allocate to the VPC.<br />If not specified, the VPC will not have an IPv6 range allocated.<br />Once ranges are allocated, they will be added to the IPv6 field. |  |  |

config/crd/bases/infrastructure.cluster.x-k8s.io_linodevpcs.yaml:96

  • [nitpick] Consider adding an OpenAPI validation (e.g., x-kubernetes-validations) for the ipv6Range[].range property to enforce valid formats ('auto' or '/') at the schema level and prevent invalid values earlier.
                  properties:

Comment thread internal/controller/linodemachine_controller_helpers.go

@AshleyDumaine AshleyDumaine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not wild about the field names, but we're following the existing naming convention from https://techdocs.akamai.com/linode-api/reference/post-vpc and https://github.com/linode/linodego/blob/proj/vpc-dual-stack/vpc_subnet.go so looks good to me 👍

@rahulait rahulait merged commit 760e7fd into main Jul 17, 2025
17 checks passed
@AshleyDumaine AshleyDumaine deleted the ipv6-test branch September 9, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants