diff --git a/controllers/dscinitialization/monitoring.go b/controllers/dscinitialization/monitoring.go index f3f0df71636..857b4206ce2 100644 --- a/controllers/dscinitialization/monitoring.go +++ b/controllers/dscinitialization/monitoring.go @@ -29,8 +29,6 @@ var ( prometheusManifestsPath = filepath.Join(deploy.DefaultManifestPath, ComponentName, "prometheus", "base") prometheusConfigPath = filepath.Join(deploy.DefaultManifestPath, ComponentName, "prometheus", "apps") networkpolicyPath = filepath.Join(deploy.DefaultManifestPath, ComponentName, "networkpolicy") - NameConsoleLink = "console" - NamespaceConsoleLink = "openshift-console" ) // only when reconcile on DSCI CR, initial set to true @@ -349,7 +347,7 @@ func configurePrometheus(ctx context.Context, dsciInit *dsciv1.DSCInitialization func configureBlackboxExporter(ctx context.Context, dsciInit *dsciv1.DSCInitialization, r *DSCInitializationReconciler) error { log := logf.FromContext(ctx) consoleRoute := &routev1.Route{} - err := r.Client.Get(ctx, client.ObjectKey{Name: "console", Namespace: "openshift-console"}, consoleRoute) + err := r.Client.Get(ctx, client.ObjectKey{Name: cluster.NameConsoleLink, Namespace: cluster.NamespaceConsoleLink}, consoleRoute) if err != nil { if !k8serr.IsNotFound(err) { return err diff --git a/main.go b/main.go index 2b265a78e14..d866d913cee 100644 --- a/main.go +++ b/main.go @@ -479,6 +479,7 @@ func getCommonCache(ctx context.Context, cli client.Client, platform cluster.Pla if platform == cluster.ManagedRhoai { namespaceConfigs["redhat-ods-monitoring"] = cache.Config{} namespaceConfigs["redhat-ods-applications"] = cache.Config{} + namespaceConfigs[cluster.NamespaceConsoleLink] = cache.Config{} return namespaceConfigs, nil } cNamespaceList := &corev1.NamespaceList{} diff --git a/pkg/cluster/const.go b/pkg/cluster/const.go index af8242ded2d..68c6434b6b1 100644 --- a/pkg/cluster/const.go +++ b/pkg/cluster/const.go @@ -18,4 +18,8 @@ const ( // Default OpenShift version CR name. OpenShiftVersionObj = "version" + + // Managed cluster required route. + NameConsoleLink = "console" + NamespaceConsoleLink = "openshift-console" )