@@ -124,6 +124,40 @@ func (r Runtime) String() string {
124
124
}
125
125
}
126
126
127
+ // ServiceMonitorConfig defines configuration options for the ServiceMonitor
128
+ // deployed for NVIDIA GPU Operator resources
129
+ type ServiceMonitorConfig struct {
130
+ // Enabled indicates if ServiceMonitor is deployed
131
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
132
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable deployment of ServiceMonitor"
133
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
134
+ Enabled * bool `json:"enabled,omitempty"`
135
+
136
+ // Interval which metrics should be scraped from. If not specified Prometheus’ global scrape interval is used.
137
+ // Supported units: y, w, d, h, m, s, ms
138
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
139
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Interval which metrics should be scraped from"
140
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
141
+ Interval promv1.Duration `json:"interval,omitempty"`
142
+
143
+ // HonorLabels chooses the metric’s labels on collisions with target labels.
144
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
145
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Choose the metric's label on collisions with target labels"
146
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
147
+ HonorLabels * bool `json:"honorLabels,omitempty"`
148
+
149
+ // AdditionalLabels to add to ServiceMonitor instance
150
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
151
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Additional labels to add to ServiceMonitor instance"
152
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
153
+ AdditionalLabels map [string ]string `json:"additionalLabels,omitempty"`
154
+
155
+ // Relabelings allows to rewrite labels on metric sets
156
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
157
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Relabelings allows to rewrite labels on metric sets"
158
+ Relabelings []* promv1.RelabelConfig `json:"relabelings,omitempty"`
159
+ }
160
+
127
161
// OperatorSpec describes configuration options for the operator
128
162
type OperatorSpec struct {
129
163
// +kubebuilder:validation:Enum=docker;crio;containerd
@@ -143,6 +177,11 @@ type OperatorSpec struct {
143
177
// queryable and should be preserved when modifying objects.
144
178
Annotations map [string ]string `json:"annotations,omitempty"`
145
179
180
+ // Optional: ServiceMonitor configuration for NVIDIA GPU Operator
181
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
182
+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="ServiceMonitor configuration for NVIDIA GPU Operator"
183
+ ServiceMonitor * ServiceMonitorConfig `json:"serviceMonitor,omitempty"`
184
+
146
185
// UseOpenShiftDriverToolkit indicates if DriverToolkit image should be used on OpenShift to build and install driver modules
147
186
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
148
187
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="On OpenShift, enable DriverToolkit image to build and install driver modules"
@@ -901,7 +940,7 @@ type DCGMExporterSpec struct {
901
940
// Optional: ServiceMonitor configuration for NVIDIA DCGM Exporter
902
941
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
903
942
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="ServiceMonitor configuration for NVIDIA DCGM Exporter"
904
- ServiceMonitor * DCGMExporterServiceMonitorConfig `json:"serviceMonitor,omitempty"`
943
+ ServiceMonitor * ServiceMonitorConfig `json:"serviceMonitor,omitempty"`
905
944
}
906
945
907
946
// DCGMExporterMetricsConfig defines metrics to be collected by NVIDIA DCGM Exporter
@@ -914,40 +953,6 @@ type DCGMExporterMetricsConfig struct {
914
953
Name string `json:"name,omitempty"`
915
954
}
916
955
917
- // DCGMExporterServiceMonitorConfig defines configuration options for the ServiceMonitor
918
- // deployed for DCGM Exporter
919
- type DCGMExporterServiceMonitorConfig struct {
920
- // Enabled indicates if ServiceMonitor is deployed for NVIDIA DCGM Exporter
921
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
922
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable deployment of NVIDIA DCGM Exporter ServiceMonitor"
923
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
924
- Enabled * bool `json:"enabled,omitempty"`
925
-
926
- // Interval which metrics should be scraped from NVIDIA DCGM Exporter. If not specified Prometheus’ global scrape interval is used.
927
- // Supported units: y, w, d, h, m, s, ms
928
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
929
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Interval which metrics should be scraped from NVDIA DCGM Exporter"
930
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
931
- Interval promv1.Duration `json:"interval,omitempty"`
932
-
933
- // HonorLabels chooses the metric’s labels on collisions with target labels.
934
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
935
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Choose the metric's label on collisions with target labels"
936
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
937
- HonorLabels * bool `json:"honorLabels,omitempty"`
938
-
939
- // AdditionalLabels to add to ServiceMonitor instance for NVIDIA DCGM Exporter
940
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
941
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Additional labels to add to ServiceMonitor instance for NVIDIA DCGM Exporter"
942
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
943
- AdditionalLabels map [string ]string `json:"additionalLabels,omitempty"`
944
-
945
- // Relabelings allows to rewrite labels on metric sets for NVIDIA DCGM Exporter
946
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
947
- // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Relabelings allows to rewrite labels on metric sets for NVIDIA DCGM Exporter"
948
- Relabelings []* promv1.RelabelConfig `json:"relabelings,omitempty"`
949
- }
950
-
951
956
// DCGMSpec defines the properties for NVIDIA DCGM deployment
952
957
type DCGMSpec struct {
953
958
// Enabled indicates if deployment of NVIDIA DCGM Hostengine as a separate pod is enabled.
@@ -2040,10 +2045,10 @@ func (dcgm *DCGMSpec) IsEnabled() bool {
2040
2045
return * dcgm .Enabled
2041
2046
}
2042
2047
2043
- // IsEnabled returns true if ServiceMonitor for DCGM Exporter is enabled through gpu-operator
2044
- func (sm * DCGMExporterServiceMonitorConfig ) IsEnabled () bool {
2048
+ // IsEnabled returns true if ServiceMonitor is enabled through gpu-operator
2049
+ func (sm * ServiceMonitorConfig ) IsEnabled () bool {
2045
2050
if sm .Enabled == nil {
2046
- // ServiceMonitor for DCGM Exporter is disabled by default
2051
+ // ServiceMonitor is disabled by default
2047
2052
return false
2048
2053
}
2049
2054
return * sm .Enabled
0 commit comments