Bug 1925236

Summary: OpenShift Route targets every port of a multi-port service
Product: OpenShift Container Platform Reporter: jakang
Component: NetworkingAssignee: Stephen Greene <sgreene>
Networking sub component: router QA Contact: jechen <jechen>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: aiyengar, amcdermo, aos-bugs, hongli
Version: 4.5   
Target Milestone: ---   
Target Release: 4.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-27 22:41:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Creating a route that targets one port in the user interface none

Description jakang 2021-02-04 16:25:25 UTC
Created attachment 1755089 [details]
Creating a route that targets one port in the user interface

Description of problem:

I am trying to create an OpenShift route to a Kubernetes service with multiple ports.  I only want to route to one port of the service.


Version-Release number of selected component (if applicable):


Steps to Reproduce:
1. Create a service with multiple ports, e.g. https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services

2. Create a route to one port of the service (see attachment), or run ```oc expose svc <service-name> --port <port>```

Actual results:

```oc describe route <route-name>```

> Output

```
...
Endpoint Port:		server

Service:	<example-service>
Weight:		100 (100%)
Endpoints:	10.129.2.38:8084, 10.129.2.38:8081
```


Expected results:

```
...
Endpoint Port:		server

Service:	<example-service>
Weight:		100 (100%)
Endpoints:	10.129.2.38:8081
```

Comment 1 Stephen Greene 2021-02-05 19:56:02 UTC
This is a reproducible issue with `oc describe route`. Note that `oc expose svc <service-name> --port <port>` appears to be working as intended. `oc describe route` is simply divulging more endpoints than it should be, since the router only serves endpoints that correspond to spec.Port.

Comment 3 jechen 2021-02-25 01:25:02 UTC
verified correct endpoint is displayed in "oc describe route" with oc48 client after creating a route to one specified port in a multi-port service  

[jechen@jechen bin]$ oc version
Client Version: 4.8.0-0.nightly-2021-02-23-200827
Server Version: 4.8.0-0.nightly-2021-02-24-063313
Kubernetes Version: v1.20.0+6f8878d


(steps omitted here) created web server pod and svc with two ports first

[jechen@jechen test2]$ oc get ep
NAME         ENDPOINTS                           AGE
web-server   10.129.2.61:8443,10.129.2.61:8080   15s

[jechen@jechen test2]$ oc expose svc web-server –port=8080

[jechen@jechen bin]$ oc describe route
Name:			web-server
Namespace:		test
Created:		About an hour ago
Labels:			name=web-server
Annotations:		openshift.io/host.generated=true
Requested Host:		web-server-test.apps.jechen-oc48-0223b.qe.devcluster.openshift.com
			   exposed on router default (host apps.jechen-oc48-0223b.qe.devcluster.openshift.com) about an hour ago
Path:			<none>
TLS Termination:	<none>
Insecure Policy:	<none>
Endpoint Port:		8080

Service:	web-server
Weight:		100 (100%)
Endpoints:	10.129.2.61:8080

Comment 6 errata-xmlrpc 2021-07-27 22:41:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438