mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
fixes kubernetes_sd (#983)
* fixes kubernetes_sd, adds missing service metadata for pod ports without endpoint https://github.com/VictoriaMetrics/VictoriaMetrics/issues/982 * fix test
This commit is contained in:
parent
2a8bd2b5cc
commit
dd2f815204
3 changed files with 13 additions and 0 deletions
|
@ -158,6 +158,9 @@ func (eps *Endpoints) appendTargetLabels(ms []map[string]string, pods []Pod, svc
|
|||
}
|
||||
p.appendCommonLabels(m)
|
||||
p.appendContainerLabels(m, c, &cp)
|
||||
if svc != nil {
|
||||
svc.appendCommonLabels(m)
|
||||
}
|
||||
ms = append(ms, m)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,6 +113,9 @@ func (eps *EndpointSlice) appendTargetLabels(ms []map[string]string, pods []Pod,
|
|||
}
|
||||
p.appendCommonLabels(m)
|
||||
p.appendContainerLabels(m, c, &cp)
|
||||
if svc != nil {
|
||||
svc.appendCommonLabels(m)
|
||||
}
|
||||
ms = append(ms, m)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,6 +420,13 @@ func TestEndpointSlice_appendTargetLabels(t *testing.T) {
|
|||
"__meta_kubernetes_pod_phase": "",
|
||||
"__meta_kubernetes_pod_ready": "unknown",
|
||||
"__meta_kubernetes_pod_uid": "some-pod-uuid",
|
||||
"__meta_kubernetes_service_cluster_ip": "",
|
||||
"__meta_kubernetes_service_label_service_label_1": "value-1",
|
||||
"__meta_kubernetes_service_label_service_label_2": "value-2",
|
||||
"__meta_kubernetes_service_labelpresent_service_label_1": "true",
|
||||
"__meta_kubernetes_service_labelpresent_service_label_2": "true",
|
||||
"__meta_kubernetes_service_name": "custom-esl",
|
||||
"__meta_kubernetes_service_type": "ClusterIP",
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue