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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yoyosir
Copy link

@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
…or.servicemonitors.md

Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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