dcgm-exporter: enable ServiceMonitor by default and skip gracefully when Prometheus CRD is absent#2262
Open
VincentG1234 wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
…present Signed-off-by: Vincent Gimenes <vincent.gimenes@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The DCGM Exporter
ServiceMonitorhas been opt-in (enabled: false) since the feature was introduced in 2022. Every user who wants GPU metrics scraped by Prometheus must remember to setserviceMonitor.enabled: true— a silent misconfiguration that causes hours of debugging (#305 #363) .On top of that, when
enabled: trueis set and the PrometheusServiceMonitorCRD is absent, the operator returnsNotReadyand blocks the entire reconcile loop (re-queuing every 5 seconds). This was documented in release 23.3 with added logging, but the underlying blocking behavior was never fixed. As a result, missing Prometheus CRDs prevent GFD pods from starting.Solution
Two minimal changes:
serviceMonitor.enabled: trueby default invalues.yaml.ServiceMonitorCRD is absent, the operator now returnsReadyand skips gracefully instead of blocking the reconcile loop. This alignsstate-dcgm-exporterwith the existing behavior ofstate-operator-metrics, which already handled this case correctly.An explicit
enabled: falsecontinues to disable and remove the resource.enabled: true+ CRD absentNotReady(blocks reconcile loop, GFD stalls)Ready(silent skip)enabled: true+ CRD presentenabled: falseexplicitDisabledDisabled(unchanged)Changes
deployments/gpu-operator/values.yaml—serviceMonitor.enabled: false→enabled: true.controllers/object_controls.go—ServiceMonitor(): CRD-absent path returnsReadyinstead ofNotReady, consistent withstate-operator-metrics.api/nvidia/v1/clusterpolicy_types.go—DCGMExporterServiceMonitorConfig.IsEnabled(): nil defaults totrue, consistent with the rest of the codebase.Testing
go test ./controllers/... -run TestServiceMonitor -v