Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support kubernetes_role argument for prometheus.operator.servicemonitors #2023

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

yoyosir
Copy link
Contributor

@yoyosir yoyosir commented Nov 3, 2024

PR Description

This PR adds support for endpointslice role in prometheus.operator.servicemonitors. Before this PR, the role defaults to endpoints. So there was no way to have servicemonitor to scrape an endpointslice in alloy.

Example config in alloy after this PR.

prometheus.operator.servicemonitors "servicemonitors_endpointslice" {
  forward_to = [prometheus.relabel.servicemonitors_filter.receiver]
  selector {
    match_expression {
      key      = "kubernetes-scrape-role"
      operator = "In"
      values   = ["endpointslice"]
    }
  }
  clustering {
      enabled = true
  }

  kubernetes_role = "endpointslice"
}

prometheus.operator.servicemonitors "servicemonitors" {
  forward_to = [prometheus.relabel.servicemonitors_filter.receiver]
  selector {
    match_expression {
      key      = "kubernetes-scrape-role"
      operator = "NotIn"
      values   = ["endpointslice"]
    }
  }

  clustering {
      enabled = true
  }

}

Which issue(s) this PR fixes

Fixes #1714

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

@clayton-cornell clayton-cornell dismissed their stale review November 4, 2024 18:09

Clicked approve instead of comment

@clayton-cornell clayton-cornell requested a review from a team November 4, 2024 18:09
@yoyosir
Copy link
Contributor Author

yoyosir commented Nov 6, 2024

@clayton-cornell can you help take a look again

@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Nov 6, 2024
@clayton-cornell
Copy link
Contributor

Docs look OK. Over to @grafana/grafana-alloy-maintainers for a code review.

Copy link
Contributor

@thampiotr thampiotr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@thampiotr thampiotr merged commit e6f887d into grafana:main Nov 8, 2024
15 checks passed
vaxvms pushed a commit to vaxvms/alloy that referenced this pull request Nov 15, 2024
…ors (grafana#2023)

* Support kubernetes_role argument for prometheus.operator.servicemonitors

* Update docs/sources/reference/components/prometheus/prometheus.operator.servicemonitors.md

Co-authored-by: Clayton Cornell <[email protected]>

* Use DefaultArguments to handle default

* Fix doc

* Update docs/sources/reference/components/prometheus/prometheus.operator.servicemonitors.md

Co-authored-by: Piotr <[email protected]>

* Add validation

---------

Co-authored-by: Clayton Cornell <[email protected]>
Co-authored-by: Piotr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Docs Squad label across all Grafana Labs repos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support endpointslices.discovery.k8s.io for prometheus.operator.servicemonitors
3 participants