-
Notifications
You must be signed in to change notification settings - Fork 12
HYPERFLEET-581 - feat: Add ServiceMonitor to Helm chart for Prometheus Operator #43
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
base: main
Are you sure you want to change the base?
Conversation
…s Operator Add ServiceMonitor template to enable automatic Prometheus Operator scraping of metrics on port 9090. Configuration options in values.yaml: - serviceMonitor.enabled (default: false) - serviceMonitor.interval (default: 30s) - serviceMonitor.scrapeTimeout (default: 10s) - serviceMonitor.labels (for Prometheus selector matching) - serviceMonitor.namespace (optional override)
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughThe pull request adds Prometheus Operator integration to the Helm chart by introducing a ServiceMonitor template (rendered when .Values.serviceMonitor.enabled is true), updates values.yaml with a serviceMonitor configuration block (enabled, interval, scrapeTimeout, labels, namespace), and extends documentation with a "Prometheus Operator Integration" section showing installation and configuration examples. The ServiceMonitor template sets apiVersion, kind, metadata, selector.matchLabels, optional namespace/namespaceSelector, and endpoints (port, path, interval, scrapeTimeout) based on chart values. Sequence Diagram(s)sequenceDiagram
participant Dev as Developer (Helm)
participant Helm as Helm CLI
participant K8s as Kubernetes API
participant PO as Prometheus Operator
participant Svc as Target Service
Dev->>Helm: helm install/upgrade chart (serviceMonitor.enabled=true)
Helm->>Helm: Render templates (ServiceMonitor created)
Helm->>K8s: Apply ServiceMonitor manifest
K8s->>PO: Persist ServiceMonitor resource
PO->>K8s: Discover ServiceMonitor.selector -> find matching Service
PO->>Svc: Scrape /metrics on configured port/path/interval
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Add ServiceMonitor options to Helm values table and expand Monitoring section with usage examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@charts/templates/servicemonitor.yaml`:
- Line 1: Exclude Helm chart templates from yamllint by updating your CI
yamllint configuration to ignore the charts/templates directory (so directives
like "{{- if .Values.serviceMonitor.enabled }}" won't be parsed by yamllint),
and while editing charts/templates/servicemonitor.yaml also fix the brace
spacing complaint by normalizing template tag whitespace (e.g. remove extra
spaces inside mustache tags so occurrences of "{{ .Values.xxx }}" become
"{{.Values.xxx}}" or follow your project's template whitespace convention), then
run yamllint to confirm no remaining errors.
Summary
ServiceMonitortemplate to enable automatic Prometheus Operator scraping of metricsserviceMonitorconfiguration section invalues.yamlwith configurable options:enabledflag (default: false)intervalsetting (default: 30s)scrapeTimeoutsetting (default: 10s)labelsfor Prometheus selector matchingnamespaceoverride optionTest plan
serviceMonitor.enabled=trueResolves: https://issues.redhat.com/browse/HYPERFLEET-581
Summary by CodeRabbit