From efe2e28bb5161c73f847f9d8dd4d866915a8182f Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Mon, 23 Sep 2019 21:02:36 +0800 Subject: [PATCH] host: use publicURL endpoint for system services --- pkg/hostman/hostinfo/hostinfo.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/hostman/hostinfo/hostinfo.go b/pkg/hostman/hostinfo/hostinfo.go index 6683dccb41..d687fc902f 100644 --- a/pkg/hostman/hostinfo/hostinfo.go +++ b/pkg/hostman/hostinfo/hostinfo.go @@ -1293,9 +1293,11 @@ func (h *SHostInfo) unregister() { } func (h *SHostInfo) OnCatalogChanged(catalog mcclient.KeystoneServiceCatalogV3) { + // TODO: dynamic probe endpoint type + defaultEndpointType := "publicURL" if options.HostOptions.ManageNtpConfiguration { ntpd := system_service.GetService("ntpd") - urls, _ := catalog.GetServiceURLs("ntp", options.HostOptions.Region, "", "internalURL") + urls, _ := catalog.GetServiceURLs("ntp", options.HostOptions.Region, "", defaultEndpointType) if len(urls) > 0 { log.Infof("Get Ntp urls: %v", urls) } else { @@ -1325,11 +1327,11 @@ func (h *SHostInfo) OnCatalogChanged(catalog mcclient.KeystoneServiceCatalogV3) "res_type": "host", } conf["nics"] = h.getNicsTelegrafConf() - urls, _ := catalog.GetServiceURLs("kafka", options.HostOptions.Region, "", "internalURL") + urls, _ := catalog.GetServiceURLs("kafka", options.HostOptions.Region, "", defaultEndpointType) if len(urls) > 0 { conf["kafka"] = map[string]interface{}{"brokers": urls, "topic": "telegraf"} } - urls, _ = catalog.GetServiceURLs("influxdb", options.HostOptions.Region, "", "internalURL") + urls, _ = catalog.GetServiceURLs("influxdb", options.HostOptions.Region, "", defaultEndpointType) if len(urls) > 0 { conf["influxdb"] = map[string]interface{}{"url": urls, "database": "telegraf"} } @@ -1339,7 +1341,7 @@ func (h *SHostInfo) OnCatalogChanged(catalog mcclient.KeystoneServiceCatalogV3) } urls, _ = catalog.GetServiceURLs("elasticsearch", - options.HostOptions.Region, "zone", "internalURL") + options.HostOptions.Region, "zone", defaultEndpointType) if len(urls) > 0 { conf["elasticsearch"] = map[string]interface{}{"url": urls[0]} fluentbit := system_service.GetService("fluentbit")