HYPERFLEET-1363 - feat: add Grafana dashboard provisioning to Helm chart - #326
HYPERFLEET-1363 - feat: add Grafana dashboard provisioning to Helm chart#326Ruclo wants to merge 1 commit into
Conversation
|
[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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@charts/values.schema.json`:
- Around line 891-915: Extend the serviceMonitor schema definition with entries
for honorLabels, metricRelabeling, and namespaceSelector, using boolean, array,
and object types respectively to match the values consumed by
servicemonitor.yaml. Keep the existing serviceMonitor properties unchanged and
align each new definition with the corresponding values.yaml/template input.
In `@docs/deployment.md`:
- Around line 448-454: Update the Helm examples in the deployment documentation
so each monitoring variant is a complete, copy-pastable shell command: repeat
the full helm install command for the custom Prometheus selector and alternate
namespace examples, or connect all --set options with valid shell continuations.
In `@docs/logging.md`:
- Line 59: Update the logging documentation’s sampler configuration to use
parentbased_traceidratio instead of parentbased_always_on wherever the default
sampler is described, and keep OTEL_TRACES_SAMPLER_ARG=0.1 as the 10%
root-sampling value. Reconcile the fallback/default argument text in the logging
guide so the examples and explanatory sections consistently describe the same
sampler behavior, including the sections referenced by the existing sampler
settings and fallback descriptions.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 17793209-8027-4e78-939f-01a497925735
📒 Files selected for processing (9)
charts/README.mdcharts/templates/deployment.yamlcharts/templates/servicemonitor.yamlcharts/values.schema.jsoncharts/values.yamldocs/config.mddocs/deployment.mddocs/logging.mdscripts/test-helm.sh
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
Risk Score: 1 —
|
| Signal | Detail | Points |
|---|---|---|
| PR size | 412 lines (>200) | +1 |
| Sensitive paths | none | +0 |
Computed by hyperfleet-risk-scorer
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@charts/templates/servicemonitor.yaml`:
- Line 1: Update the ServiceMonitor example in docs/metrics.md to use the
chart’s actual values path, monitoring.serviceMonitor.enabled, instead of the
obsolete root-level serviceMonitor.enabled. Keep the example aligned with the
ServiceMonitor template symbol .Values.monitoring.serviceMonitor.enabled so
copied configuration will render the resource correctly.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 4e9a30f4-def7-4c2e-add1-2057c6d6e522
📒 Files selected for processing (9)
charts/README.mdcharts/templates/deployment.yamlcharts/templates/servicemonitor.yamlcharts/values.schema.jsoncharts/values.yamldocs/config.mddocs/deployment.mddocs/logging.mdscripts/test-helm.sh
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
🚧 Files skipped from review as they are similar to previous changes (8)
- docs/config.md
- scripts/test-helm.sh
- docs/deployment.md
- charts/README.md
- docs/logging.md
- charts/templates/deployment.yaml
- charts/values.yaml
- charts/values.schema.json
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/logging.md`:
- Around line 392-402: Update the default-sampling statement in the telemetry
documentation to match the runtime fallback in parseSamplingRate and
pkg/telemetry/otel.go: describe ParentBased(TraceIDRatioBased(...)) and clarify
that the configured rate applies to root spans while parent sampling decisions
are respected. Remove the claim that all traces are sampled by default, and
retain parentbased_always_on only as an explicitly configured sampler option.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: f6b88f22-c5a7-4b92-863e-1d95fc23cc4b
📒 Files selected for processing (9)
charts/README.mdcharts/templates/deployment.yamlcharts/templates/servicemonitor.yamlcharts/values.schema.jsoncharts/values.yamldocs/config.mddocs/deployment.mddocs/logging.mdscripts/test-helm.sh
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
🚧 Files skipped from review as they are similar to previous changes (6)
- scripts/test-helm.sh
- charts/templates/deployment.yaml
- charts/README.md
- docs/config.md
- docs/deployment.md
- charts/values.schema.json
874ee73 to
a8af034
Compare
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@charts/templates/configmap-dashboard.yaml`:
- Around line 1-12: Increment the chart version in Chart.yaml from 1.1.0 to the
next version, keeping the existing parent revision unchanged, then run make
test-helm with Helm installed to verify the chart.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: c336e75d-3489-482a-8e24-9ddf16af41c5
📒 Files selected for processing (10)
charts/README.mdcharts/templates/configmap-dashboard.yamlcharts/templates/deployment.yamlcharts/templates/servicemonitor.yamlcharts/values.schema.jsoncharts/values.yamldocs/config.mddocs/deployment.mddocs/logging.mdscripts/test-helm.sh
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
🚧 Files skipped from review as they are similar to previous changes (7)
- docs/config.md
- scripts/test-helm.sh
- docs/logging.md
- charts/values.schema.json
- charts/values.yaml
- docs/deployment.md
- charts/templates/deployment.yaml
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@charts/Chart.yaml`:
- Line 5: Update the version advertised by the badge in charts/README.md from
1.1.0 to 1.2.0 so it matches the version declared in Chart.yaml.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 250b3fda-01c7-4b9d-8ec3-7a3f21c01090
📒 Files selected for processing (11)
charts/Chart.yamlcharts/README.mdcharts/templates/configmap-dashboard.yamlcharts/templates/deployment.yamlcharts/templates/servicemonitor.yamlcharts/values.schema.jsoncharts/values.yamldocs/config.mddocs/deployment.mddocs/logging.mdscripts/test-helm.sh
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
🚧 Files skipped from review as they are similar to previous changes (8)
- docs/config.md
- scripts/test-helm.sh
- docs/deployment.md
- docs/logging.md
- charts/templates/deployment.yaml
- charts/README.md
- charts/values.schema.json
- charts/values.yaml
| description: HyperFleet API - Cluster Lifecycle Management Service | ||
| type: application | ||
| version: 1.1.0 | ||
| version: 1.2.0 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Update the chart version in charts/README.md.
charts/Chart.yaml now declares version: 1.2.0, but charts/README.md:1 still advertises Version: 1.1.0. Update the README badge in this change so release documentation matches the chart metadata.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@charts/Chart.yaml` at line 5, Update the version advertised by the badge in
charts/README.md from 1.1.0 to 1.2.0 so it matches the version declared in
Chart.yaml.
Source: Path instructions
…ng section Consolidate all observability configuration under a single monitoring: section for consistency across HyperFleet charts. - Move serviceMonitor and tracing from top-level to monitoring section - Add honorLabels, metricRelabeling, namespaceSelector to serviceMonitor - Add dashboard toggle for future Grafana sidecar provisioning - Default sampler to parentbased_always_on
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Helm chart version changes to 1.2.0. Monitoring values now nest ServiceMonitor and tracing settings under Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@charts/templates/configmap-dashboard.yaml`:
- Around line 1-12: Update the NOTES.txt template to document the
monitoring.dashboard.enabled value and explain that Grafana dashboard
provisioning requires the grafana_dashboard: "1" sidecar label used by the
hyperfleet-api dashboard ConfigMap.
In `@charts/templates/servicemonitor.yaml`:
- Around line 31-32: Validate monitoring.serviceMonitor.interval and
scrapeTimeout in charts/values.schema.json for supported Prometheus duration
syntax, and enforce that scrapeTimeout is not greater than interval while
allowing equal values. Update charts/templates/servicemonitor.yaml to fail
rendering when either duration is invalid or the timeout exceeds the interval,
rather than emitting values the Prometheus Operator will reject.
In `@charts/values.yaml`:
- Around line 435-453: Prevent the unused root-level serviceMonitor
configuration in values.yaml from silently passing validation: either wire
serviceMonitor.* to the monitoring.serviceMonitor implementation as an explicit
compatibility alias, or reject it with a clear migration error directing users
to monitoring.serviceMonitor.*. Update docs/metrics.md and chart API consumers
to use the supported path.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 3df4aea8-c083-46ab-866c-39740442b53e
📒 Files selected for processing (11)
charts/Chart.yamlcharts/README.mdcharts/templates/configmap-dashboard.yamlcharts/templates/deployment.yamlcharts/templates/servicemonitor.yamlcharts/values.schema.jsoncharts/values.yamldocs/config.mddocs/deployment.mddocs/logging.mdscripts/test-helm.sh
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
| {{- if .Values.monitoring.dashboard.enabled }} | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ include "hyperfleet-api.fullname" . }}-grafana-dashboard | ||
| labels: | ||
| {{- include "hyperfleet-api.labels" . | nindent 4 }} | ||
| grafana_dashboard: "1" | ||
| data: | ||
| hyperfleet-api.json: |- | ||
| {{- .Files.Get "dashboards/hyperfleet-api.json" | nindent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Update charts/templates/NOTES.txt for dashboard provisioning.
This template adds the user-facing monitoring.dashboard.enabled feature. Document the enablement value and the Grafana sidecar label requirement in charts/templates/NOTES.txt.
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@charts/templates/configmap-dashboard.yaml` around lines 1 - 12, Update the
NOTES.txt template to document the monitoring.dashboard.enabled value and
explain that Grafana dashboard provisioning requires the grafana_dashboard: "1"
sidecar label used by the hyperfleet-api dashboard ConfigMap.
Source: Path instructions
| interval: {{ .Values.monitoring.serviceMonitor.interval }} | ||
| scrapeTimeout: {{ .Values.monitoring.serviceMonitor.scrapeTimeout }} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- target template ---'
cat -n charts/templates/servicemonitor.yaml | sed -n '1,90p'
printf '%s\n' '--- values and schema sections ---'
rg -n -C 12 '"serviceMonitor"|"interval"|"scrapeTimeout"|serviceMonitor:' charts/values.yaml charts/values.schema.json
printf '%s\n' '--- chart documentation and version ---'
rg -n -C 8 'scrapeTimeout|serviceMonitor|monitoring' charts README.md docs 2>/dev/null || true
cat -n charts/Chart.yaml | sed -n '1,80p'
printf '%s\n' '--- chart tests or validation helpers ---'
rg -n 'fail |required |regex|scrapeTimeout|helm template|ServiceMonitor' charts .github 2>/dev/null || trueRepository: openshift-hyperfleet/hyperfleet-api
Length of output: 50393
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- relevant chart diff ---'
git diff -- charts/templates/servicemonitor.yaml charts/values.yaml charts/values.schema.json charts/Chart.yaml docs/metrics.md docs/deployment.md | sed -n '1,260p'
printf '%s\n' '--- validation patterns ---'
rg -n -C 4 'pattern|minimum|maximum|fail |required |regexMatch|duration' charts/values.schema.json charts/templates charts/tests 2>/dev/null | sed -n '1,260p'
printf '%s\n' '--- ServiceMonitor duration references in related charts ---'
rg -n -C 5 'scrapeTimeout|interval' charts 2>/dev/null | sed -n '1,220p'Repository: openshift-hyperfleet/hyperfleet-api
Length of output: 17014
🌐 Web query:
Prometheus Operator ServiceMonitor endpoint scrapeTimeout must be less than interval validation
💡 Result:
Yes, the Prometheus Operator enforces that the scrapeTimeout value defined in a ServiceMonitor must be less than or equal to the defined scrape interval [1][2]. If the scrapeTimeout is configured to be greater than the scrape interval, the Prometheus Operator will reject the ServiceMonitor resource [1][3]. This validation is implemented to ensure efficient and logical scraping behavior, as a scrape cannot logically time out after a duration longer than the interval at which it is triggered [4]. In the Prometheus Operator API, the scrapeTimeout field is optional; if it is not explicitly defined, Prometheus uses the global scrape timeout, provided that the global value is not itself greater than the target's scrape interval (in which case the interval is used as the timeout) [2][3]. The validation logic is handled within the Prometheus Operator's reconciliation and selection processes [5]. While earlier versions relied solely on internal Go-based validation [4][5], the operator ensures consistency across resource types—including ServiceMonitors, PodMonitors, and Probes—to prevent invalid scrape configurations [4][6].
Citations:
- 1: https://prometheus-operator.dev/docs/api-reference/api/
- 2: https://github.com/prometheus-operator/prometheus-operator/blob/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
- 3: https://jsonnet-libs.github.io/prometheus-operator-libsonnet/0.83/monitoring/v1/serviceMonitor/
- 4: pkg/prometheus: Add validation for ScrapeTimeout prometheus-operator/prometheus-operator#4491
- 5: https://pkg.go.dev/github.com/prometheus-operator/prometheus-operator/pkg/prometheus
- 6: Ensure that duration fields are valid prometheus-operator/prometheus-operator#4282
🏁 Script executed (no clone):
#!/bin/bash
set -euo pipefail
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -fsSL \
https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/Documentation/api.md \
-o "$tmpdir/api.md"
curl -fsSL \
https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/pkg/apis/monitoring/v1/servicemonitor_types.go \
-o "$tmpdir/servicemonitor_types.go"
printf '%s\n' '--- scrapeTimeout documentation ---'
rg -n -C 8 'scrapeTimeout|ScrapeTimeout|interval' "$tmpdir/api.md" "$tmpdir/servicemonitor_types.go"
printf '%s\n' '--- validation implementation references ---'
curl -fsSL \
https://api.github.com/search/code?q=repo%3Aprometheus-operator%2Fprometheus-operator+scrapeTimeout+interval+language%3AGo \
| jq -r '.message // empty, (.items[]?.html_url // empty)' || true
Length of output: 176
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import json
from pathlib import Path
schema = json.loads(Path("charts/values.schema.json").read_text())
sm = schema["properties"]["monitoring"]["properties"]["serviceMonitor"]["properties"]
for name in ("interval", "scrapeTimeout"):
print(name, json.dumps(sm[name], indent=2))
for value in ("30s", "10s", "0s", "-1s", "not-a-duration", "1h30m"):
print("schema-shape", value, isinstance(value, str))
PYRepository: openshift-hyperfleet/hyperfleet-api
Length of output: 501
🏁 Script executed (no clone):
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import re
# Prometheus model durations use the sequence of number+unit terms:
# ms, s, m, h, d, w, y.
pattern = re.compile(r"^(?:0|[1-9][0-9]*(?:ms|s|m|h|d|w|y))+$")
cases = {
"30s": True,
"10s": True,
"1h30m": True,
"0s": True,
"-1s": False,
"not-a-duration": False,
"10 seconds": False,
}
for value, expected_syntax in cases.items():
actual = bool(pattern.fullmatch(value))
print(f"{value!r}: syntax={actual}, expected={expected_syntax}")
PY
Length of output: 389
🏁 Script executed (no clone):
#!/bin/bash
set -euo pipefail
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
for url in \
"https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/pkg/apis/monitoring/v1/types.go" \
"https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml" \
"https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/pkg/prometheus/promcfg.go"
do
file="$tmpdir/$(basename "$url")"
curl -fsSL "$url" -o "$file"
done
rg -n -C 10 'scrapeTimeout|ScrapeTimeout|interval|Interval|must be less|greater than' "$tmpdir"
Length of output: 50343
🏁 Script executed (no clone):
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import re
# Prometheus Operator's ServiceMonitor CRD accepts this duration grammar.
duration = re.compile(
r"^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?"
r"(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$"
)
units = {"ms": 1, "s": 1000, "m": 60_000, "h": 3_600_000,
"d": 86_400_000, "w": 604_800_000, "y": 31_536_000_000}
def milliseconds(value):
if not duration.fullmatch(value):
return None
total = 0
for number, unit in re.findall(r"([0-9]+)(y|w|d|h|m|s|ms)", value):
total += int(number) * units[unit]
return total
def operator_result(interval, timeout):
i, t = milliseconds(interval), milliseconds(timeout)
if i is None or t is None:
return "reject: invalid duration"
return "reject: timeout greater than interval" if t > i else "accept"
for interval, timeout in [
("30s", "10s"),
("10s", "10s"),
("30s", "40s"),
("30s", "not-a-duration"),
("not-a-duration", "10s"),
]:
print(f"interval={interval}, scrapeTimeout={timeout}: {operator_result(interval, timeout)}")
PY
Length of output: 414
Reject invalid ServiceMonitor scrape durations before rendering.
The schema accepts arbitrary strings, and the template renders them directly. Values such as not-a-duration or scrapeTimeout: 40s with interval: 30s cause the Prometheus Operator to reject the ServiceMonitor. Add duration syntax validation and fail when scrapeTimeout is greater than interval; equal durations are valid.
📍 Affects 2 files
charts/templates/servicemonitor.yaml#L31-L32(this comment)charts/values.schema.json#L899-L905
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@charts/templates/servicemonitor.yaml` around lines 31 - 32, Validate
monitoring.serviceMonitor.interval and scrapeTimeout in
charts/values.schema.json for supported Prometheus duration syntax, and enforce
that scrapeTimeout is not greater than interval while allowing equal values.
Update charts/templates/servicemonitor.yaml to fail rendering when either
duration is invalid or the timeout exceeds the interval, rather than emitting
values the Prometheus Operator will reject.
Source: Path instructions
| # -- ServiceMonitor for Prometheus Operator scrape configuration | ||
| serviceMonitor: | ||
| # -- Create a ServiceMonitor resource | ||
| enabled: false | ||
| # -- Scrape interval | ||
| interval: 30s | ||
| # -- Scrape timeout (must be less than interval) | ||
| scrapeTimeout: 10s | ||
| # -- Additional labels for ServiceMonitor discovery | ||
| labels: {} | ||
| # -- Honor labels from the target to avoid overwriting | ||
| honorLabels: true | ||
| # -- Metric relabel configs applied before ingestion | ||
| metricRelabeling: [] | ||
| # -- Namespace selector for cross-namespace monitoring | ||
| namespaceSelector: {} | ||
| # -- Namespace to create the ServiceMonitor in (defaults to release namespace) | ||
| namespace: "" | ||
|
|
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- local legacy value references ---'
rg -n -C 2 '(^|[^[:alnum:]_])serviceMonitor\.(enabled|interval|scrapeTimeout|labels|namespace)|^[[:space:]]*serviceMonitor:[[:space:]]*$' .
printf '%s\n' '--- organization-wide legacy value references ---'
gh search code 'serviceMonitor.enabled org:openshift-hyperfleet' --limit 100Repository: openshift-hyperfleet/hyperfleet-api
Length of output: 10448
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- chart files and current references ---'
git ls-files charts docs scripts | sed -n '1,160p'
rg -n -C 3 'serviceMonitor|monitoring:' charts/values.yaml charts/templates/servicemonitor.yaml charts/README.md docs/deployment.md docs/metrics.md scripts/test-helm.sh || true
printf '%s\n' '--- chart schema and version ---'
fd -i 'values.schema.json|Chart.yaml|NOTES.txt' charts -x sh -c 'echo --- "$1"; cat -n "$1"' sh {} \;
printf '%s\n' '--- branch change summary ---'
git diff --stat
git diff -- charts/values.yaml charts/templates/servicemonitor.yaml charts/README.md docs/deployment.md docs/metrics.md scripts/test-helm.sh | sed -n '1,260p'Repository: openshift-hyperfleet/hyperfleet-api
Length of output: 50393
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- adapter documentation references ---'
rg -n -C 3 'serviceMonitor|monitoring\.serviceMonitor' hyperfleet/components/adapter/framework/adapter-deployment.md || trueRepository: openshift-hyperfleet/architecture
Length of output: 316
🏁 Script executed:
set -euo pipefail
python3 - <<'PY'
import json
from pathlib import Path
schema = json.loads(Path("charts/values.schema.json").read_text())
print("root additionalProperties:", schema.get("additionalProperties", "<omitted: JSON Schema default is true>"))
print("root serviceMonitor property:", "serviceMonitor" in schema.get("properties", {}))
monitoring = schema.get("properties", {}).get("monitoring", {})
print("monitoring additionalProperties:", monitoring.get("additionalProperties", "<omitted: JSON Schema default is true>"))
print("monitoring properties:", sorted(monitoring.get("properties", {})))
sm = monitoring.get("properties", {}).get("serviceMonitor", {})
print("monitoring.serviceMonitor additionalProperties:", sm.get("additionalProperties", "<omitted: JSON Schema default is true>"))
print("monitoring.serviceMonitor properties:", sorted(sm.get("properties", {})))
PY
printf '%s\n' '--- legacy-path handling ---'
rg -n -C 3 '(^|[^[:alnum:]_])serviceMonitor(\.enabled|:)|legacy|deprecated|migration' charts/templates charts/values.schema.json charts/values.yaml scripts docs/metrics.md || trueRepository: openshift-hyperfleet/hyperfleet-api
Length of output: 2046
🏁 Script executed:
set -euo pipefail
python3 - <<'PY'
from copy import deepcopy
defaults = {
"monitoring": {
"serviceMonitor": {
"enabled": False,
"interval": "30s",
"scrapeTimeout": "10s",
"labels": {},
"honorLabels": True,
"metricRelabeling": [],
"namespaceSelector": {},
"namespace": "",
}
}
}
def helm_set(defaults, path, value):
merged = deepcopy(defaults)
node = merged
parts = path.split(".")
for part in parts[:-1]:
node = node.setdefault(part, {})
node[parts[-1]] = value
return merged
for label, values in [
("root-only", helm_set(defaults, "serviceMonitor.enabled", True)),
("nested-only", helm_set(defaults, "monitoring.serviceMonitor.enabled", True)),
("both", helm_set(helm_set(defaults, "serviceMonitor.enabled", True),
"monitoring.serviceMonitor.enabled", False)),
]:
nested_enabled = values["monitoring"]["serviceMonitor"]["enabled"]
print(f"{label}: root={values.get('serviceMonitor', {}).get('enabled')!r}, "
f"monitoring.serviceMonitor.enabled={nested_enabled!r}, "
f"ServiceMonitor rendered={nested_enabled}")
PYRepository: openshift-hyperfleet/hyperfleet-api
Length of output: 447
Reject legacy serviceMonitor.* values (CWE-16).
The chart renders ServiceMonitor only when monitoring.serviceMonitor.enabled is true. Root-level serviceMonitor.enabled=true passes schema validation but is ignored. Keep a compatibility alias or reject the legacy path with a migration error. Update docs/metrics.md and API chart consumers.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@charts/values.yaml` around lines 435 - 453, Prevent the unused root-level
serviceMonitor configuration in values.yaml from silently passing validation:
either wire serviceMonitor.* to the monitoring.serviceMonitor implementation as
an explicit compatibility alias, or reject it with a clear migration error
directing users to monitoring.serviceMonitor.*. Update docs/metrics.md and chart
API consumers to use the supported path.
Sources: Path instructions, Linked repositories
Why
Part of HYPERFLEET-1363 — unify observability values under
monitoring:across all HyperFleet component charts and consolidate dashboard provisioning.Changes
serviceMonitorandtracingundermonitoring:sectionmonitoring.dashboard.enabledtoggle for future Grafana sidecar provisioninghonorLabels,metricRelabeling,namespaceSelectorto serviceMonitorparentbased_always_onvalues.schema.jsonto match new pathsdeployment.md,logging.md,config.md) andscripts/test-helm.shTest plan
make test-helmpasses (21 tests)OBSERVABILITY_ENABLED=true