Bug 1925236 - OpenShift Route targets every port of a multi-port service
Summary: OpenShift Route targets every port of a multi-port service
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Networking
Version: 4.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.8.0
Assignee: Stephen Greene
QA Contact: jechen
Depends On:
TreeView+ depends on / blocked
Reported: 2021-02-04 16:25 UTC by jakang
Modified: 2022-08-04 22:32 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Last Closed: 2021-07-27 22:41:34 UTC
Target Upstream Version:

Attachments (Terms of Use)
Creating a route that targets one port in the user interface (133.49 KB, image/png)
2021-02-04 16:25 UTC, jakang
no flags Details

System ID Private Priority Status Summary Last Updated
Github openshift oc pull 730 0 None closed Bug 1925236: RouteDescriber: Filter endpoints on route.Spec.Port 2021-02-15 14:41:26 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 22:42:14 UTC

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%)

Expected results:

Endpoint Port:		server

Service:	<example-service>
Weight:		100 (100%)

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,   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%)

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.


Note You need to log in before you can comment on or make changes to this bug.