Skip to content

Commit

Permalink
Merge pull request #1794 from jcantrill/log3321b
Browse files Browse the repository at this point in the history
LOG-3321: fix crash when console is not enabled
  • Loading branch information
openshift-merge-robot committed Dec 16, 2022
2 parents ff6e8af + 0b19953 commit 4cd0c67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 0 additions & 5 deletions controllers/clusterlogging/clusterlogging_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
ctrl "sigs.k8s.io/controller-runtime"

log "github.com/ViaQ/logerr/v2/log/static"
consolev1alpha1 "github.com/openshift/api/console/v1alpha1"
loggingv1 "github.com/openshift/cluster-logging-operator/apis/logging/v1"
"github.com/openshift/cluster-logging-operator/internal/constants"
"github.com/openshift/cluster-logging-operator/internal/k8shandler"
Expand Down Expand Up @@ -189,10 +188,6 @@ func (r *ReconcileClusterLogging) SetupWithManager(mgr ctrl.Manager) error {
IsController: true,
OwnerType: &loggingv1.ClusterLogging{},
}).
Watches(&source.Kind{Type: &consolev1alpha1.ConsolePlugin{}}, &handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: &loggingv1.ClusterLogging{},
}).
Watches(&source.Kind{Type: &corev1.Secret{}},
handler.EnqueueRequestsFromMapFunc(toElasticsearchRelatedObjRequestMapper),
builder.WithPredicates(onAllExceptGenericEventsPredicate),
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"time"

loggingv1 "github.com/openshift/cluster-logging-operator/apis/logging/v1"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -88,6 +89,8 @@ func main() {
"go_arch", runtime.GOARCH,
)

// https://issues.redhat.com/browse/LOG-3321
syncPeriod := time.Minute * 3
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Namespace: constants.WatchNamespace,
Expand All @@ -96,6 +99,7 @@ func main() {
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "b430cc2e.openshift.io",
SyncPeriod: &syncPeriod,
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down

0 comments on commit 4cd0c67

Please sign in to comment.