Skip to content

Conversation

@rafabene
Copy link
Contributor

@rafabene rafabene commented Feb 2, 2026

Summary

  • Add ServiceMonitor template to enable automatic Prometheus Operator scraping of metrics
  • Add serviceMonitor configuration section in values.yaml with configurable options:
    • enabled flag (default: false)
    • interval setting (default: 30s)
    • scrapeTimeout setting (default: 10s)
    • labels for Prometheus selector matching
    • namespace override option

Test plan

  • Helm lint passes
  • Template renders correctly with serviceMonitor.enabled=true
  • Template renders correctly with custom namespace and labels
  • Deploy to cluster with Prometheus Operator and verify metrics scraping

Resolves: https://issues.redhat.com/browse/HYPERFLEET-581

Summary by CodeRabbit

  • New Features
    • Optional Prometheus Operator integration: enable ServiceMonitor-based metrics scraping with configurable enable flag, scrape interval, timeout, labels, and namespace.
  • Documentation
    • Expanded Monitoring docs with Prometheus Operator Integration guide, examples for enabling ServiceMonitor, custom labels, and separate namespace deployment.

…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)
@openshift-ci openshift-ci bot requested review from AlexVulaj and tirthct February 2, 2026 18:32
@openshift-ci
Copy link

openshift-ci bot commented Feb 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yasun1 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Walkthrough

The 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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a ServiceMonitor resource to the Helm chart for Prometheus Operator integration, which is the primary objective of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Add ServiceMonitor options to Helm values table and expand
Monitoring section with usage examples.
Copy link

@coderabbitai coderabbitai bot left a 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.

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.

1 participant