grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.3k stars 176 forks source link

support endpointslices.discovery.k8s.io for prometheus.operator.servicemonitors #1714

Open GroovyCarrot opened 2 days ago

GroovyCarrot commented 2 days ago

Request

The prometheus.operator.servicemonitors component currently only supports the legacy endpoints discovery resource.

Recently support was added to the prometheus operator for the new endpointslices.discovery.k8s.io resources: https://github.com/prometheus-operator/prometheus-operator/pull/6672

Following the pattern they implemented, would suggest we need a role = "endpoints|endpointslices" argument on the component to decide which resource to use for discovery, as they did not opt for a field on the CRD to denote the role.

endpointslices are already supported by discovery.kubernetes.

Use case

This is important as endpointslices are far more flexible, supporting FQDNs as well as IP addresses, and offers tenants a way to define static_configs / discovery.relabel targets via a resource in kubernetes rather than in the agent config itself.

sidewinder12s commented 2 days ago

Also interested in this, I'd thought that Grafana would have supported endpoint slices at this point. We actually just hit a bug with endpoints that isn't present in EndpointSlices.

Edit: Kubernetes actually shipped a regression that will expose users to stale endpoints values as well if anyone else ends up here because of that: https://github.com/kubernetes/kubernetes/issues/127370