mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape/discovery/kubernetes: add __meta_kubernetes_endpoints_label_*
and __meta_kuberntes_endpoints_annotation_*
labels to role: endpoints
This syncs kubernetes SD with Prometheus 2.25
See 617c56f55a
This commit is contained in:
parent
cb6eba2ce0
commit
fccb481de2
3 changed files with 22 additions and 10 deletions
|
@ -9,6 +9,7 @@
|
|||
* FEATURE: vmalert: add `-datasource.appendTypePrefix` command-line option for querying both Prometheus and Graphite datasource in cluster version of VictoriaMetrics. See [these docs](https://victoriametrics.github.io/vmalert.html#graphite) for details.
|
||||
* FEATURE: vmauth: add ability to route requests from a single user to multiple destinations depending on the requested paths. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1064
|
||||
* FEATURE: remove dependency on external programs such as `cat`, `grep` and `cut` when detecting cpu and memory limits inside Docker or LXC container.
|
||||
* FEATURE: vmagent: add `__meta_kubernetes_endpoints_label_*`, `__meta_kubernetes_endpoints_labelpresent_*`, `__meta_kubernetes_endpoints_annotation_*` and `__meta_kubernetes_endpoints_annotationpresent_*` labels for `role: endpoints` in Kubernetes service discovery. These labels where added in Prometheus 2.25.
|
||||
|
||||
* BUGFIX: properly convert regexp tag filters containing escaped dots to non-regexp tag filters. For example, `{foo=~"bar\.baz"}` should be converted to `{foo="bar.baz"}`. Previously it was incorrectly converted to `{foo="bar\.baz"}`, which could result in missing time series for this tag filter.
|
||||
* BUGFIX: do not spam error logs when discovering Docker Swarm targets without dedicated IP. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1028 .
|
||||
|
|
|
@ -183,6 +183,7 @@ func getEndpointLabelsForAddressAndPort(podPortsSeen map[*Pod][]int, eps *Endpoi
|
|||
if svc != nil {
|
||||
svc.appendCommonLabels(m)
|
||||
}
|
||||
eps.Metadata.registerLabelsAndAnnotations("__meta_kubernetes_endpoints", m)
|
||||
if ea.TargetRef.Kind != "Pod" || p == nil {
|
||||
return m
|
||||
}
|
||||
|
|
|
@ -42,7 +42,13 @@ func TestParseEndpointsListSuccess(t *testing.T) {
|
|||
"selfLink": "/api/v1/namespaces/default/endpoints/kubernetes",
|
||||
"uid": "0972c7d9-c267-4b93-a090-a417eeb9b385",
|
||||
"resourceVersion": "150",
|
||||
"creationTimestamp": "2020-03-16T20:44:25Z"
|
||||
"creationTimestamp": "2020-03-16T20:44:25Z",
|
||||
"labels": {
|
||||
"foo": "bar"
|
||||
},
|
||||
"annotations": {
|
||||
"x": "y"
|
||||
}
|
||||
},
|
||||
"subsets": [
|
||||
{
|
||||
|
@ -91,15 +97,19 @@ func TestParseEndpointsListSuccess(t *testing.T) {
|
|||
expectedLabelss := [][]prompbmarshal.Label{
|
||||
discoveryutils.GetSortedLabels(map[string]string{
|
||||
"__address__": "172.17.0.2:8443",
|
||||
"__meta_kubernetes_endpoint_address_target_kind": "Pod",
|
||||
"__meta_kubernetes_endpoint_address_target_name": "coredns-6955765f44-lnp6t",
|
||||
"__meta_kubernetes_endpoint_hostname": "aaa.bbb",
|
||||
"__meta_kubernetes_endpoint_node_name": "foobar",
|
||||
"__meta_kubernetes_endpoint_port_name": "https",
|
||||
"__meta_kubernetes_endpoint_port_protocol": "TCP",
|
||||
"__meta_kubernetes_endpoint_ready": "true",
|
||||
"__meta_kubernetes_endpoints_name": "kubernetes",
|
||||
"__meta_kubernetes_namespace": "default",
|
||||
"__meta_kubernetes_endpoint_address_target_kind": "Pod",
|
||||
"__meta_kubernetes_endpoint_address_target_name": "coredns-6955765f44-lnp6t",
|
||||
"__meta_kubernetes_endpoint_hostname": "aaa.bbb",
|
||||
"__meta_kubernetes_endpoint_node_name": "foobar",
|
||||
"__meta_kubernetes_endpoint_port_name": "https",
|
||||
"__meta_kubernetes_endpoint_port_protocol": "TCP",
|
||||
"__meta_kubernetes_endpoint_ready": "true",
|
||||
"__meta_kubernetes_endpoints_name": "kubernetes",
|
||||
"__meta_kubernetes_endpoints_annotation_x": "y",
|
||||
"__meta_kubernetes_endpoints_annotationpresent_x": "true",
|
||||
"__meta_kubernetes_endpoints_label_foo": "bar",
|
||||
"__meta_kubernetes_endpoints_labelpresent_foo": "true",
|
||||
"__meta_kubernetes_namespace": "default",
|
||||
}),
|
||||
}
|
||||
if !reflect.DeepEqual(sortedLabelss, expectedLabelss) {
|
||||
|
|
Loading…
Reference in a new issue