harden(recipes): direct dependencyRefs from monitoring-CR creators to prometheus-operator-crds#1100
Conversation
… prometheus-operator-crds Components whose Helm templates emit monitoring.coreos.com/v1 CRs previously relied on a multi-hop transitive path to reach prometheus-operator-crds. Removing any intermediate edge (e.g., gpu-operator -> kube-prometheus-stack) would silently break the helm-diff CRD-registration race that #914/#926 fixed. This hardens the DAG so the direct edge survives refactors: - nvsentinel: add prometheus-operator-crds direct dependencyRef (chart emits PodMonitor). - k8s-ephemeral-storage-metrics: add prometheus-operator-crds direct dependencyRef (chart emits ServiceMonitor). - nvsentinel registry comment: drop "transitively satisfied" wording. - pkg/recipe: new TestMonitoringCREmittersHaveDirectPrometheusOperatorCRDsEdge fails if any known emitter (kube-prometheus-stack, nvsentinel, k8s-ephemeral-storage-metrics) drops the direct edge. The emitter list is grounded in `helm template` output of each chart at the version pinned in base.yaml using the checked-in values file; the test body documents the refresh recipe. Fixes: #928 Related: #914, #926
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR hardens the recipe dependency graph by enforcing direct Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Coverage Report ✅
Coverage BadgeNo Go source files changed in this PR. |
Summary
Add direct
dependencyRefs: [prometheus-operator-crds]to every base component whose Helm templates emitmonitoring.coreos.com/v1CRs (nvsentinel, k8s-ephemeral-storage-metrics) so the DAG-stratified helmfile layout survives refactors of intermediate nodes, plus a Go test that enforces the invariant.Motivation / Context
After #926 split
prometheus-operator-crdsout as its own release, several components that createmonitoring.coreos.com/v1CRs (PodMonitor / ServiceMonitor / etc.) reached the CRDs only via a multi-hop transitive path:If anyone removes the
gpu-operator → kube-prometheus-stackedge inrecipes/overlays/base.yaml— plausible since gpu-operator doesn't strictly need kube-prometheus-stack to install — the helm-diff race on nvsentinel's PodMonitor CR silently returns. No CI test catches it; the failure surfaces only on a fresh-clusterhelmfile apply. This PR closes that gap by making the edge direct and asserting the invariant in a unit test.Fixes: #928
Related: #914, #926
Type of Change
Component(s) Affected
pkg/recipe)Implementation Notes
Audit method. Rendered each Helm chart in
recipes/overlays/base.yaml(and registry/mixins) at its pinned version with its checked-in values file, then grepped forapiVersion: monitoring.coreos.com. Install-time emitters at our values:kube-prometheus-stacknvsentinelk8s-ephemeral-storage-metricsOther charts whose RBAC
apiGroupsmentionmonitoring.coreos.com(gpu-operator, network-operator, k8s-nim-operator, kai-scheduler, slinky-slurm-operator) do not emit any monitoring CR in their install-time templates — the operators create those CRs at runtime once their own CRD is reconciled, which is after install ordering matters.Test.
TestMonitoringCREmittersHaveDirectPrometheusOperatorCRDsEdgeinpkg/recipe/yaml_test.goenforces a direct edge (not just closure membership). Closure is too weak — the very failure the issue describes is "transitive only" silently breaking. The test body documents thehelm template … | grep -c apiVersion: monitoring.coreos.comrefresh recipe for chart bumps.nvsentinel registry comment. Reworded to reflect the direct edge in base.yaml instead of the four-hop chain.
Testing
Per-package coverage on
pkg/recipe:Risk Assessment
Rollout notes: No CLI/API surface change. Generated bundles include the same components in the same install levels (verified by chainsaw
cli-bundle-helmfileandcli-recipe-overlays).Checklist
make testwith-race)make lint)git commit -S)