Skip to content

Commit

Permalink
fix: mutating hook for binoculars panicking on nil pointer dereference (
Browse files Browse the repository at this point in the history
#294)

* fix mutating hook for binoculars panicking on nil pointer dereference

* lint fixes for binoculars webhook
  • Loading branch information
dejanzele committed Dec 4, 2023
1 parent cd140a6 commit bda0e29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/install/v1alpha1/binoculars_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ func (r *Binoculars) Default() {
}

// prometheus
if r.Spec.Prometheus.ScrapeInterval == nil {
r.Spec.Prometheus.ScrapeInterval = &metav1.Duration{Duration: time.Second * 10}
if r.Spec.Prometheus != nil && r.Spec.Prometheus.Enabled {
if r.Spec.Prometheus.ScrapeInterval == nil {
r.Spec.Prometheus.ScrapeInterval = &metav1.Duration{Duration: time.Second * 10}
}
}

}

0 comments on commit bda0e29

Please sign in to comment.