Bug 1430003 - oc adm router ports are not placed in the correct environment variables.
Summary: oc adm router ports are not placed in the correct environment variables.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Routing
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Ben Bennett
QA Contact: zhaozhanqi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-07 15:58 UTC by Kenny Woodson
Modified: 2017-04-03 20:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-03 20:22:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Kenny Woodson 2017-03-07 15:58:03 UTC
Description of problem:
When using oc adm router to create a router the ports are only set correctly in the environment variables when using the default 80 and 443.  That means the deployment config variables for ROUTER_SERVICE_HTTP_PORT and for ROUTER_SERVICE_HTTPS_PORT are hard coded in the deployment config returned from oc adm router.

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

How reproducible:
Every time.

Steps to Reproduce:
1. oc adm router test-router --ports='8080:8080,8443:8443' --stats-port=1937 --dry-run -o yaml
2.  In the yaml output, verify 

          - name: ROUTER_SERVICE_HTTPS_PORT
            value: "443"
          - name: ROUTER_SERVICE_HTTP_PORT
            value: "80"

          ports:
          - containerPort: 8080
          - containerPort: 8443
          - containerPort: 1937
            name: stats
            protocol: TCP

3.

Actual results:
The ports specified do not end up in the right environment variables.

Expected results:
--ports 8080:8080,8443:8443
          - name: ROUTER_SERVICE_HTTPS_PORT
            value: "8443"
          - name: ROUTER_SERVICE_HTTP_PORT
            value: "8080"

Additional info:

When setting up multiple router shards we run into a place where the default router works fine as we are defaulting the ports but when specifying the ports for the second router this requires an edit to the environment variables.

The current interface to oc adm router for ports is probably insufficient to determine which protocol should be used unless it is modified.  Might be something like 80:80:http,443:443:https.

Comment 1 Ben Bennett 2017-04-03 20:22:55 UTC
I understand your confusion, but --ports is really only supposed to set the port mappings in the pod.  But, if you are using --host-network=true (the default) then the port-mappings are not used anyway.  They don't control the way that the image inside the router listens for its port.  For haproxy you would also need to set the environment variables that you identified to the appropriate values.


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