Current Behavior
When Kubernetes Endpoints change, EndpointsReconciler rebuilds upstream handles for all ingresses that reference the service using the first TCP port from each endpoint subset.
CoreV1EndpointPort endpointPort = ports.stream()
.filter(coreV1EndpointPort -> "TCP".equals(coreV1EndpointPort.getProtocol()))
.findFirst()
.orElseThrow(...);
The service-to-ingress cache only stores namespace/service to ingress names, not the backend service port selected by each ingress. updateSelectors(...) then applies the same rebuilt upstream handle to all cached divide/websocket selectors for that service.
If a service exposes multiple TCP ports and an ingress selects a non-first port, or multiple ingresses select different ports on the same service, an endpoint update can rewrite selectors to the wrong upstream port.
Expected Behavior
Endpoint reconciliation should preserve the service port selected by each ingress backend instead of using the first TCP endpoint port for every selector associated with the service.
Impact
For multi-port services, endpoint updates can silently route divide/websocket traffic to the wrong upstream port.
Code Location
shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/EndpointsReconciler.java
endpointAddresses() picks the first TCP port from the endpoint subset.
updateSelectors() applies the rebuilt handle to all selectors associated with the service.
shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/cache/ServiceIngressCache.java
- cache key does not retain the ingress backend service port.
Current Behavior
When Kubernetes Endpoints change,
EndpointsReconcilerrebuilds upstream handles for all ingresses that reference the service using the first TCP port from each endpoint subset.The service-to-ingress cache only stores namespace/service to ingress names, not the backend service port selected by each ingress.
updateSelectors(...)then applies the same rebuilt upstream handle to all cached divide/websocket selectors for that service.If a service exposes multiple TCP ports and an ingress selects a non-first port, or multiple ingresses select different ports on the same service, an endpoint update can rewrite selectors to the wrong upstream port.
Expected Behavior
Endpoint reconciliation should preserve the service port selected by each ingress backend instead of using the first TCP endpoint port for every selector associated with the service.
Impact
For multi-port services, endpoint updates can silently route divide/websocket traffic to the wrong upstream port.
Code Location
shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/EndpointsReconciler.javaendpointAddresses()picks the first TCP port from the endpoint subset.updateSelectors()applies the rebuilt handle to all selectors associated with the service.shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/cache/ServiceIngressCache.java