mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
fixes dockerswarm (#1053)
fixes improper usage of host network services https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1028
This commit is contained in:
parent
2aa37b0450
commit
6fc2a8e544
1 changed files with 5 additions and 0 deletions
|
@ -99,6 +99,11 @@ func addServicesLabels(services []service, networksLabels map[string]map[string]
|
||||||
commonLabels["__meta_dockerswarm_service_label_"+discoveryutils.SanitizeLabelName(k)] = v
|
commonLabels["__meta_dockerswarm_service_label_"+discoveryutils.SanitizeLabelName(k)] = v
|
||||||
}
|
}
|
||||||
for _, vip := range service.Endpoint.VirtualIPs {
|
for _, vip := range service.Endpoint.VirtualIPs {
|
||||||
|
// skip services without virtual address.
|
||||||
|
// usually its host services.
|
||||||
|
if vip.Addr == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
ip, _, err := net.ParseCIDR(vip.Addr)
|
ip, _, err := net.ParseCIDR(vip.Addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("cannot parse: %q as cidr for service label add, err: %v", vip.Addr, err)
|
logger.Errorf("cannot parse: %q as cidr for service label add, err: %v", vip.Addr, err)
|
||||||
|
|
Loading…
Reference in a new issue