Aias00 opened a new issue, #6493:
URL: https://github.com/apache/shenyu/issues/6493

   ### 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.
   
   ```java
   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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to