Skip to content

Commit 531244d

Browse files
committed
fix
1 parent 3d9a3b4 commit 531244d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

internal/controller/httproute_controller.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,20 @@ func (r *HTTPRouteReconciler) processHTTPRouteBackendRefs(tctx *provider.Transla
397397
continue
398398
}
399399

400-
var service corev1.Service
401-
if err := r.Get(tctx, client.ObjectKey{
400+
serviceNS := types.NamespacedName{
402401
Namespace: namespace,
403402
Name: name,
404-
}, &service); err != nil {
403+
}
404+
405+
var service corev1.Service
406+
if err := r.Get(tctx, serviceNS, &service); err != nil {
405407
terr = err
406408
continue
407409
}
410+
if service.Spec.Type == corev1.ServiceTypeExternalName {
411+
tctx.Services[serviceNS] = &service
412+
return nil
413+
}
408414

409415
portExists := false
410416
for _, port := range service.Spec.Ports {
@@ -417,10 +423,7 @@ func (r *HTTPRouteReconciler) processHTTPRouteBackendRefs(tctx *provider.Transla
417423
terr = fmt.Errorf("port %d not found in service %s", *backend.Port, name)
418424
continue
419425
}
420-
tctx.Services[client.ObjectKey{
421-
Namespace: namespace,
422-
Name: name,
423-
}] = &service
426+
tctx.Services[serviceNS] = &service
424427

425428
endpointSliceList := new(discoveryv1.EndpointSliceList)
426429
if err := r.List(tctx, endpointSliceList,
@@ -434,11 +437,7 @@ func (r *HTTPRouteReconciler) processHTTPRouteBackendRefs(tctx *provider.Transla
434437
continue
435438
}
436439

437-
tctx.EndpointSlices[client.ObjectKey{
438-
Namespace: namespace,
439-
Name: name,
440-
}] = endpointSliceList.Items
441-
440+
tctx.EndpointSlices[serviceNS] = endpointSliceList.Items
442441
}
443442
return terr
444443
}

0 commit comments

Comments
 (0)