Improve EndpointController's handling of headless services under dual-stack

EndpointController was accidentally requiring all headless services to
be IPv4-only in clusters with IPv6DualStack enabled.

This still leaves "legacy" (ie, IPFamily-less) headless services as
always IPv4-only because the controller doesn't currently have easy
access to the information that would allow it to fix that.
(EndpointSliceController had the same problem already, and still
does.) This can be fixed, if needed, by manually setting IPFamily,
and the proposed API for 1.20 will handle this situation better.
This commit is contained in:
Dan Winship
2020-05-24 17:48:59 -04:00
parent 9023d19c57
commit e46572ef4b
6 changed files with 39 additions and 32 deletions

View File

@@ -1249,21 +1249,21 @@ func TestPodToEndpointAddressForService(t *testing.T) {
expectedEndpointFamily: ipv6,
},
// {
// name: "v6 headless service, in a dual stack cluster",
//
// enableDualStack: true,
// ipFamilies: ipv4ipv6,
//
// service: v1.Service{
// Spec: v1.ServiceSpec{
// ClusterIP: v1.ClusterIPNone,
// IPFamily: &ipv6,
// },
// },
//
// expectedEndpointFamily: ipv6,
// },
{
name: "v6 headless service, in a dual stack cluster",
enableDualStack: true,
ipFamilies: ipv4ipv6,
service: v1.Service{
Spec: v1.ServiceSpec{
ClusterIP: v1.ClusterIPNone,
IPFamily: &ipv6,
},
},
expectedEndpointFamily: ipv6,
},
{
name: "v6 legacy headless service, in a dual stack cluster",