Add exposed metrics listener instead of replacing loopback listener

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2021-09-10 08:35:00 -07:00 committed by Brad Davidson
parent 29c8b238e5
commit b4d8c641c6

View File

@ -586,10 +586,11 @@ func (e *ETCD) clientURL() string {
// metricsURL returns the metrics access address
func (e *ETCD) metricsURL(expose bool) string {
address := "http://127.0.0.1:2381"
if expose {
return fmt.Sprintf("http://%s:2381", e.address)
address = fmt.Sprintf("http://%s:2381,%s", e.address, address)
}
return "http://127.0.0.1:2381"
return address
}
// cluster returns ETCDConfig for a cluster
@ -598,7 +599,7 @@ func (e *ETCD) cluster(ctx context.Context, forceNew bool, options executor.Init
Name: e.name,
InitialOptions: options,
ForceNewCluster: forceNew,
ListenClientURLs: fmt.Sprintf(e.clientURL() + ",https://127.0.0.1:2379"),
ListenClientURLs: e.clientURL() + ",https://127.0.0.1:2379",
ListenMetricsURLs: e.metricsURL(e.config.EtcdExposeMetrics),
ListenPeerURLs: e.peerURL(),
AdvertiseClientURLs: e.clientURL(),