Skip to content

Commit bda0e29

Browse files
authored
fix: mutating hook for binoculars panicking on nil pointer dereference (#294)
* fix mutating hook for binoculars panicking on nil pointer dereference * lint fixes for binoculars webhook
1 parent cd140a6 commit bda0e29

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/install/v1alpha1/binoculars_webhook.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ func (r *Binoculars) Default() {
6868
}
6969

7070
// prometheus
71-
if r.Spec.Prometheus.ScrapeInterval == nil {
72-
r.Spec.Prometheus.ScrapeInterval = &metav1.Duration{Duration: time.Second * 10}
71+
if r.Spec.Prometheus != nil && r.Spec.Prometheus.Enabled {
72+
if r.Spec.Prometheus.ScrapeInterval == nil {
73+
r.Spec.Prometheus.ScrapeInterval = &metav1.Duration{Duration: time.Second * 10}
74+
}
7375
}
76+
7477
}

0 commit comments

Comments
 (0)