diff --git a/coredns/plugin/handler_test.go b/coredns/plugin/handler_test.go index 30845624..31d5812a 100644 --- a/coredns/plugin/handler_test.go +++ b/coredns/plugin/handler_test.go @@ -975,10 +975,12 @@ func testClusterSetIP() { si := newServiceImport(namespace1, service1, mcsv1a1.ClusterSetIP) si.Spec.IPs = []string{clusterSetIP} - si.Spec.Ports = []mcsv1a1.ServicePort{port1, port2} t.lh.Resolver.PutServiceImport(si) + si.Spec.Ports = []mcsv1a1.ServicePort{port1, port2} + t.lh.Resolver.PutServiceImport(si) + t.lh.Resolver.PutEndpointSlices(newEndpointSlice(namespace1, service1, clusterID, []mcsv1a1.ServicePort{port1}, newEndpoint(serviceIP, "", true))) diff --git a/coredns/resolver/clusterip_service_test.go b/coredns/resolver/clusterip_service_test.go index d5482ebf..471ebbb5 100644 --- a/coredns/resolver/clusterip_service_test.go +++ b/coredns/resolver/clusterip_service_test.go @@ -450,9 +450,11 @@ func testClusterSetIP() { BeforeEach(func() { si := newAggregatedServiceImport(namespace1, service1) + si.Spec.IPs = []string{clusterSetIP} - si.Spec.Ports = []mcsv1a1.ServicePort{port1, port2} + t.resolver.PutServiceImport(si) + si.Spec.Ports = []mcsv1a1.ServicePort{port1, port2} t.resolver.PutServiceImport(si) t.putEndpointSlice(newClusterIPEndpointSlice(namespace1, service1, clusterID1, serviceIP1, true, port1)) diff --git a/coredns/resolver/service_import.go b/coredns/resolver/service_import.go index 7ca0e352..44a77d7b 100644 --- a/coredns/resolver/service_import.go +++ b/coredns/resolver/service_import.go @@ -43,13 +43,13 @@ func (i *Interface) PutServiceImport(serviceImport *mcsv1a1.ServiceImport) { balancer: loadbalancer.NewSmoothWeightedRR(), } - if !isLegacy { - svcInfo.spec = serviceImport.Spec - } - i.serviceMap[key] = svcInfo } + if !isLegacy { + svcInfo.spec = serviceImport.Spec + } + svcInfo.isExported = true if svcInfo.isHeadless() || !isLegacy {