Skip to content

Commit

Permalink
OCPBUGS-3541: Don't create route_metrics_controiller_routes_per_shard…
Browse files Browse the repository at this point in the history
… metrics for ingress controllers that are not admitted
  • Loading branch information
gcs278 committed Dec 14, 2022
1 parent d9d1a2b commit d2d7e7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 5 additions & 7 deletions pkg/manifests/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion pkg/operator/controller/route-metrics/controller.go
Expand Up @@ -5,10 +5,12 @@ import (
"fmt"
"time"

"golang.org/x/time/rate"

operatorv1 "github.com/openshift/api/operator/v1"
routev1 "github.com/openshift/api/route/v1"
logf "github.com/openshift/cluster-ingress-operator/pkg/log"
"golang.org/x/time/rate"
"github.com/openshift/cluster-ingress-operator/pkg/util/ingresscontroller"

corev1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -172,6 +174,11 @@ func (r *reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
return reconcile.Result{}, nil
}

// If the Ingress Controller is not admitted, don't provide metrics for it.
if !ingresscontroller.IsAdmitted(ingressController) {
return reconcile.Result{}, nil
}

// NOTE: Even though the route admitted status should reflect validity of the namespace and route labelselectors, we still will validate
// the namespace and route labels as there are still edge scenarios where the route status may be inaccurate.

Expand Down

0 comments on commit d2d7e7a

Please sign in to comment.