@@ -40,6 +40,7 @@ func MonitoringStack(
40
40
if err != nil {
41
41
return nil , err
42
42
}
43
+ scrapeInterval := monv1 .Duration (instance .Spec .MonitoringStack .ScrapeInterval )
43
44
monitoringStack := & obov1.MonitoringStack {
44
45
ObjectMeta : metav1.ObjectMeta {
45
46
Name : instance .Name ,
@@ -51,10 +52,8 @@ func MonitoringStack(
51
52
Disabled : ! instance .Spec .MonitoringStack .AlertingEnabled ,
52
53
},
53
54
PrometheusConfig : & obov1.PrometheusConfig {
54
- Replicas : & telemetryv1 .PrometheusReplicas ,
55
- // NOTE: unsupported before OBOv0.0.21, but we can set the value
56
- // in the ServiceMonitor, so this isn't a big deal.
57
- //ScrapeInterval: instance.Spec.MonitoringStack.ScrapeInterval,
55
+ Replicas : & telemetryv1 .PrometheusReplicas ,
56
+ ScrapeInterval : & scrapeInterval ,
58
57
PersistentVolumeClaim : pvc ,
59
58
},
60
59
Retention : monv1 .Duration (instance .Spec .MonitoringStack .Storage .Retention ),
@@ -68,7 +67,10 @@ func MonitoringStack(
68
67
69
68
func getPVCSpec (instance * telemetryv1.MetricStorage ) (* corev1.PersistentVolumeClaimSpec , error ) {
70
69
if instance .Spec .MonitoringStack .Storage .Strategy == "persistent" {
71
- persistentSpec := & instance .Spec .MonitoringStack .Storage .Persistent
70
+ persistentSpec := instance .Spec .MonitoringStack .Storage .Persistent
71
+ if persistentSpec == nil {
72
+ return nil , fmt .Errorf ("Received a nil value in persistent storage config" )
73
+ }
72
74
pvc := corev1.PersistentVolumeClaimSpec {}
73
75
if ! reflect .DeepEqual (persistentSpec .PvcStorageSelector , metav1.LabelSelector {}) {
74
76
pvc .Selector = & persistentSpec .PvcStorageSelector
0 commit comments