[fix] filter EndpointSlices by IP family for target group registration#4783
[fix] filter EndpointSlices by IP family for target group registration#4783shuqz wants to merge 2 commits into
Conversation
The endpoint resolver listed every EndpointSlice for a Service without considering address family, so an IPv6 target group could receive IPv4 pod addresses and get rejected by RegisterTargets. The resolver now filters slices to those matching the TGB's ipAddressType.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: shuqz The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4783 +/- ##
==========================================
+ Coverage 56.09% 57.07% +0.97%
==========================================
Files 388 396 +8
Lines 30932 31579 +647
==========================================
+ Hits 17352 18024 +672
+ Misses 12566 12497 -69
- Partials 1014 1058 +44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| // tgbTargetIPAddressType returns the TGB's IP address type, defaulting to IPv4 when unset. | ||
| func tgbTargetIPAddressType(tgb *elbv2api.TargetGroupBinding) elbv2api.TargetGroupIPAddressType { |
There was a problem hiding this comment.
How about using endpointSliceAddressType ? each EndpointSlice has one AddressType
func endpointSliceAddressType(tgb *elbv2api.TargetGroupBinding) discovery.AddressType {
if tgb.Spec.IPAddressType != nil && *tgb.Spec.IPAddressType == elbv2api.TargetGroupIPAddressTypeIPv6 {
return discovery.AddressTypeIPv6
}
return discovery.AddressTypeIPv4
}
This way, we could make endpoint_resolve clean, only have kubernetes type
Issue
#4775
Description
When
--enable-endpoint-slices=true, the endpoint resolver listed every EndpointSlice for a Service without filtering by address family. For Services with both IPv4 and IPv6 EndpointSlices, this caused the controller to submit IPv4 pod addresses to an IPv6-only target group'sRegisterTargetscall, which AWS rejects withValidationError: The IP address '...' is not a valid IPv6 address. The affected pods' readiness gates never flipped and stayed not-ready.This change makes
ResolvePodEndpointsaccept the target group'sipAddressTypeand filter EndpointSlices to only those whoseAddressTypematches that family.Checklist
README.md, or thedocsdirectory)i was able to reproduce issue from my side, and verified the error is gone after deploying fix.
BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯