Skip to content

Add IPv6 support for EndpointSlice creation and port replacement#16591

Merged
knative-prow[bot] merged 1 commit into
knative:mainfrom
linkvt:ipv6-fixes
May 12, 2026
Merged

Add IPv6 support for EndpointSlice creation and port replacement#16591
knative-prow[bot] merged 1 commit into
knative:mainfrom
linkvt:ipv6-fixes

Conversation

@linkvt
Copy link
Copy Markdown
Member

@linkvt linkvt commented May 8, 2026

The autoscaler stat forwarder hardcoded AddressTypeIPv4 when creating EndpointSlices, which breaks on IPv6-only or dual-stack clusters. Additionally, useSecurePort used strings.Split on ":" to extract the host, which breaks on bracketed IPv6 addresses like [::1]:8012.

The issue in useSecurePort was spotted by AI, it does make sense to me though.

Reported by @matejvasek and verified locally in my IPv6 kind cluster, thanks again!
PR for fixing kourier will also follow.

Proposed Changes

  • Add addressTypeForIP helper to dynamically determine AddressType
  • Fix useSecurePort to use net.SplitHostPort/net.JoinHostPort
  • Add tests for both functions with IPv4 and IPv6 cases

/kind bug

Release Note

Add IPv6 support for autoscaler EndpointSlice creation and activator port replacement

@knative-prow knative-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 8, 2026
@knative-prow knative-prow Bot requested review from dsimansk and skonto May 8, 2026 11:11
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.26%. Comparing base (06f2ba7) to head (3602784).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/activator/handler/handler.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16591      +/-   ##
==========================================
+ Coverage   80.21%   80.26%   +0.04%     
==========================================
  Files         217      217              
  Lines       13545    13552       +7     
==========================================
+ Hits        10865    10877      +12     
+ Misses       2316     2310       -6     
- Partials      364      365       +1     

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

Comment thread pkg/autoscaler/statforwarder/leases.go Outdated
}

func addressTypeForIP(ip string) discoveryv1.AddressType {
parsed := net.ParseIP(ip)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh good suggestion, wasn't aware of that, thanks 👍 It even exists since go 1.18 🙈
Will update the PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

PTAL

@linkvt
Copy link
Copy Markdown
Member Author

linkvt commented May 11, 2026

/retest

3 similar comments
@linkvt
Copy link
Copy Markdown
Member Author

linkvt commented May 12, 2026

/retest

@matejvasek
Copy link
Copy Markdown

/retest

@linkvt
Copy link
Copy Markdown
Member Author

linkvt commented May 12, 2026

/retest

@linkvt
Copy link
Copy Markdown
Member Author

linkvt commented May 12, 2026

/retest

I mean all other e2e tests pass, very unlikely that this failure comes from my change but too lazy to investigate right now at least

Edit: Oh it might need an artifact that got removed, I'll just rebase and push again.

The autoscaler stat forwarder hardcoded AddressTypeIPv4 when creating
EndpointSlices, which breaks on IPv6-only or dual-stack clusters.
Additionally, useSecurePort used strings.Split on ":" to extract the
host, which breaks on bracketed IPv6 addresses like [::1]:8012.

Changes:
- Add addressTypeForIP helper to dynamically determine AddressType
- Fix useSecurePort to use net.SplitHostPort/net.JoinHostPort
- Add tests for both functions with IPv4 and IPv6 cases

Signed-off-by: Vincent Link <vlink@redhat.com>
@dprotaso
Copy link
Copy Markdown
Member

/retest

@dprotaso
Copy link
Copy Markdown
Member

/lgtm
/approve

@knative-prow knative-prow Bot added the lgtm Indicates that a PR is ready to be merged. label May 12, 2026
@dprotaso
Copy link
Copy Markdown
Member

thanks!

@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 12, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, linkvt

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:

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

@knative-prow knative-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 12, 2026
@knative-prow knative-prow Bot merged commit d81a762 into knative:main May 12, 2026
109 of 110 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. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants