diff --git a/config/config_test.go b/config/config_test.go index c70a73009..d5cc092a2 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -735,12 +735,12 @@ var expectedConf = &Config{ ServiceDiscoveryConfigs: discovery.Configs{ &moby.DockerSDConfig{ - Filters: []moby.Filter{}, - Host: "unix:///var/run/docker.sock", - Port: 80, - HostNetworkHost: "localhost", - RefreshInterval: model.Duration(60 * time.Second), - HTTPClientConfig: config.DefaultHTTPClientConfig, + Filters: []moby.Filter{}, + Host: "unix:///var/run/docker.sock", + Port: 80, + HostNetworkingHost: "localhost", + RefreshInterval: model.Duration(60 * time.Second), + HTTPClientConfig: config.DefaultHTTPClientConfig, }, }, }, diff --git a/discovery/moby/docker.go b/discovery/moby/docker.go index 3a5a11e7b..98dc42acb 100644 --- a/discovery/moby/docker.go +++ b/discovery/moby/docker.go @@ -51,11 +51,11 @@ const ( // DefaultDockerSDConfig is the default Docker SD configuration. var DefaultDockerSDConfig = DockerSDConfig{ - RefreshInterval: model.Duration(60 * time.Second), - Port: 80, - Filters: []Filter{}, - HostNetworkHost: "localhost", - HTTPClientConfig: config.DefaultHTTPClientConfig, + RefreshInterval: model.Duration(60 * time.Second), + Port: 80, + Filters: []Filter{}, + HostNetworkingHost: "localhost", + HTTPClientConfig: config.DefaultHTTPClientConfig, } func init() { @@ -66,10 +66,10 @@ func init() { type DockerSDConfig struct { HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` - Host string `yaml:"host"` - Port int `yaml:"port"` - Filters []Filter `yaml:"filters"` - HostNetworkHost string `yaml:"host_network_host"` + Host string `yaml:"host"` + Port int `yaml:"port"` + Filters []Filter `yaml:"filters"` + HostNetworkingHost string `yaml:"host_networking_host"` RefreshInterval model.Duration `yaml:"refresh_interval"` } @@ -106,10 +106,10 @@ func (c *DockerSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error type DockerDiscovery struct { *refresh.Discovery - client *client.Client - port int - hostNetworkHost string - filters filters.Args + client *client.Client + port int + hostNetworkingHost string + filters filters.Args } // NewDockerDiscovery returns a new DockerDiscovery which periodically refreshes its targets. @@ -117,8 +117,8 @@ func NewDockerDiscovery(conf *DockerSDConfig, logger log.Logger) (*DockerDiscove var err error d := &DockerDiscovery{ - port: conf.Port, - hostNetworkHost: conf.HostNetworkHost, + port: conf.Port, + hostNetworkingHost: conf.HostNetworkingHost, } hostURL, err := url.Parse(conf.Host) @@ -255,7 +255,7 @@ func (d *DockerDiscovery) refresh(ctx context.Context) ([]*targetgroup.Group, er if c.HostConfig.NetworkMode != "host" { addr = net.JoinHostPort(n.IPAddress, strconv.FormatUint(uint64(d.port), 10)) } else { - addr = d.hostNetworkHost + addr = d.hostNetworkingHost } labels[model.AddressLabel] = model.LabelValue(addr) diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 456a7b529..4ef8ce4e0 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -640,7 +640,7 @@ tls_config: [ port: | default = 80 ] # The host to use if the container is in host networking mode. -[ host_network_host: | default = "localhost" ] +[ host_networking_host: | default = "localhost" ] # Optional filters to limit the discovery process to a subset of available # resources.