Repository navigation
Description
While debugging bugzilla ( https://bugzilla.redhat.com/show_bug.cgi?id=1455459 ) I discovered that there is an issue with the oc adm router --dry-run -o yaml and the generated stats ports.
When generating routers we pass in the data that we expect when building and use the dry-run feature to determine if what is in memory is different than what we are currently running. This method works great.
In openshift 3.6, something changed with the generation of the dry-run data. It outputs multiple stats ports.
ports:
- containerPort: 80
- containerPort: 443
- containerPort: 1939
name: stats
protocol: TCP
- containerPort: 1935
name: router-stats
protocol: TCPWhen I dry-run the router creation with the --stats-port=1939 I get the expected output of the stats port being on 1939. The oddity is that I get a new router-stats port listening on 1935. No matter what is passed to the router command this is always produced. When running multiple routers this breaks as the 1935 is always taken by the first router to land.
This can be reproduced by the following command:
oc adm router router1 --expose-metrics=False --external-host-insecure=False --host-network=True --images=registry.ops.openshift.com/openshift3/ose-${component}:${version} --latest-images=False --ports=80:80,443:443 --replicas=1 --selector=type=infra --service-account=router --stats-port=1938 --dry-run=True -o yaml
Version
3.6.116
Steps To Reproduce
- oc adm router router1 --stats-port 1939 --dry-run -o yaml
- Verify there are 2 separate stats ports created.
Current Result
There are two separate stats ports available for stats.
Expected Result
There should be a single stats port.
Additional Information
It appears that the stats port and the health check port were shared on port 1936. With the introduction to prometheus the stats port changed to defaultstatsport - 1 which puts it on 1935.
It looks like this code was added:
https://github.com/openshift/origin/blame/master/pkg/cmd/admin/router/router.go#L684-L691
It would appear that the new code needs to reconcile the old stats port located here:
https://github.com/openshift/origin/blame/master/pkg/cmd/admin/router/router.go#L534-L543
The new router-stats should be removed and the original router stats should be updated. It should honor the command line parameter to stats as well.
Activity
juanvallejo commentedon Jun 19, 2017
cc @smarterclayton
smarterclayton commentedon Jun 19, 2017
We generate two stats ports - one for haproxy, and one that is part of the haproxy prometheus stats. So there are actually two ports.
kwoodson commentedon Jun 20, 2017
@smarterclayton, @juanvallejo,
Can we make the prometheus stats port configurable? By requiring the port be 1935, this guarantees only a single router instance running on a node. This is problematic in a multi-router sharded environment.
smarterclayton commentedon Jun 20, 2017
smarterclayton commentedon Jun 20, 2017
Proxying.
smarterclayton commentedon Jun 20, 2017
Ok, here's what I'm going to do:
smarterclayton commentedon Jun 20, 2017
@pecameron @knobunc FYI
smarterclayton commentedon Jun 21, 2017
Moving this to 3.6.0 and p1 because this has API compatibility concerns if we ship it.
smarterclayton commentedon Jun 21, 2017
Please see #14790 and comment - i think this preserves compatibility with old configs, custom configs (within reason), and reduces the number of overlapping flags (listen-addr overrides stats port, asking for new style metrics disables old stats port, specific handling of template router health checks from the openshift-router process)