Skip to content

Commit

Permalink
fix: update error message for more than 1 instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
stijzermans authored and pjuarezd committed Sep 11, 2024
1 parent de9d95f commit 3955009
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/controller/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func (c *Controller) getPrometheusAgents(ctx context.Context) ([]*promv1alpha1.P

func (c *Controller) getPrometheus(ctx context.Context) (promv1.PrometheusInterface, error) {
ns := miniov2.GetPrometheusNamespace()
promName := miniov2.GetPrometheusName()

var instances []promv1.PrometheusInterface
proms, err := c.getPrometheuses(ctx)
Expand All @@ -112,7 +111,7 @@ func (c *Controller) getPrometheus(ctx context.Context) (promv1.PrometheusInterf
return nil, errors.New("no Prometheus or PrometheusAgent found in namespace " + ns)
}
if len(instances) > 1 {
return nil, errors.New("more than one Prometheus or PrometheusAgent instance found with name " + promName)
return nil, errors.New("more than one Prometheus or PrometheusAgent instance found in namespace " + ns + ".")
}

return instances[0], nil
Expand Down

0 comments on commit 3955009

Please sign in to comment.