HostNetworkHost -> HostNetworkingHost

Signed-off-by: Levi Harrison <git@leviharrison.dev>
This commit is contained in:
Levi Harrison 2021-08-03 05:58:49 -06:00
parent 3556302c76
commit c1b1b826ce
3 changed files with 23 additions and 23 deletions

View file

@ -735,12 +735,12 @@ var expectedConf = &Config{
ServiceDiscoveryConfigs: discovery.Configs{ ServiceDiscoveryConfigs: discovery.Configs{
&moby.DockerSDConfig{ &moby.DockerSDConfig{
Filters: []moby.Filter{}, Filters: []moby.Filter{},
Host: "unix:///var/run/docker.sock", Host: "unix:///var/run/docker.sock",
Port: 80, Port: 80,
HostNetworkHost: "localhost", HostNetworkingHost: "localhost",
RefreshInterval: model.Duration(60 * time.Second), RefreshInterval: model.Duration(60 * time.Second),
HTTPClientConfig: config.DefaultHTTPClientConfig, HTTPClientConfig: config.DefaultHTTPClientConfig,
}, },
}, },
}, },

View file

@ -51,11 +51,11 @@ const (
// DefaultDockerSDConfig is the default Docker SD configuration. // DefaultDockerSDConfig is the default Docker SD configuration.
var DefaultDockerSDConfig = DockerSDConfig{ var DefaultDockerSDConfig = DockerSDConfig{
RefreshInterval: model.Duration(60 * time.Second), RefreshInterval: model.Duration(60 * time.Second),
Port: 80, Port: 80,
Filters: []Filter{}, Filters: []Filter{},
HostNetworkHost: "localhost", HostNetworkingHost: "localhost",
HTTPClientConfig: config.DefaultHTTPClientConfig, HTTPClientConfig: config.DefaultHTTPClientConfig,
} }
func init() { func init() {
@ -66,10 +66,10 @@ func init() {
type DockerSDConfig struct { type DockerSDConfig struct {
HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` HTTPClientConfig config.HTTPClientConfig `yaml:",inline"`
Host string `yaml:"host"` Host string `yaml:"host"`
Port int `yaml:"port"` Port int `yaml:"port"`
Filters []Filter `yaml:"filters"` Filters []Filter `yaml:"filters"`
HostNetworkHost string `yaml:"host_network_host"` HostNetworkingHost string `yaml:"host_networking_host"`
RefreshInterval model.Duration `yaml:"refresh_interval"` RefreshInterval model.Duration `yaml:"refresh_interval"`
} }
@ -106,10 +106,10 @@ func (c *DockerSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type DockerDiscovery struct { type DockerDiscovery struct {
*refresh.Discovery *refresh.Discovery
client *client.Client client *client.Client
port int port int
hostNetworkHost string hostNetworkingHost string
filters filters.Args filters filters.Args
} }
// NewDockerDiscovery returns a new DockerDiscovery which periodically refreshes its targets. // 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 var err error
d := &DockerDiscovery{ d := &DockerDiscovery{
port: conf.Port, port: conf.Port,
hostNetworkHost: conf.HostNetworkHost, hostNetworkingHost: conf.HostNetworkingHost,
} }
hostURL, err := url.Parse(conf.Host) 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" { if c.HostConfig.NetworkMode != "host" {
addr = net.JoinHostPort(n.IPAddress, strconv.FormatUint(uint64(d.port), 10)) addr = net.JoinHostPort(n.IPAddress, strconv.FormatUint(uint64(d.port), 10))
} else { } else {
addr = d.hostNetworkHost addr = d.hostNetworkingHost
} }
labels[model.AddressLabel] = model.LabelValue(addr) labels[model.AddressLabel] = model.LabelValue(addr)

View file

@ -640,7 +640,7 @@ tls_config:
[ port: <int> | default = 80 ] [ port: <int> | default = 80 ]
# The host to use if the container is in host networking mode. # The host to use if the container is in host networking mode.
[ host_network_host: <string> | default = "localhost" ] [ host_networking_host: <string> | default = "localhost" ]
# Optional filters to limit the discovery process to a subset of available # Optional filters to limit the discovery process to a subset of available
# resources. # resources.