Skip to content

Commit

Permalink
Merge pull request stolostron#258 from zhiweiyin318/log-mem-leak
Browse files Browse the repository at this point in the history
Use null logger to require less memory
  • Loading branch information
openshift-merge-robot authored Oct 22, 2020
2 parents 8a3735a + e6a771a commit 779455d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmd/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package main
import (
"context"
"os"
ctrlruntimelog "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/open-cluster-management/multicloud-operators-foundation/cmd/agent/app"
"github.com/open-cluster-management/multicloud-operators-foundation/cmd/agent/app/options"
Expand Down Expand Up @@ -90,6 +91,7 @@ func startManager(o *options.AgentOptions, stopCh <-chan struct{}) {
Scheme: scheme,
MetricsBindAddress: o.MetricsAddr,
Namespace: o.ClusterName,
Logger: ctrlruntimelog.NullLogger{},
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down
7 changes: 4 additions & 3 deletions cmd/controller/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import (
"io/ioutil"
"path"

"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/clusterset/clustersetmapper"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/helpers"

clusterv1 "github.com/open-cluster-management/api/cluster/v1"
clusterv1alaph1 "github.com/open-cluster-management/api/cluster/v1alpha1"
"github.com/open-cluster-management/multicloud-operators-foundation/cmd/controller/app/options"
Expand All @@ -20,9 +17,11 @@ import (
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/clusterrbac"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/clusterrole"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/clusterset/clusterrolebinding"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/clusterset/clustersetmapper"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/clusterset/syncclusterrolebinding"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/gc"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/controllers/inventory"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/helpers"
hivev1 "github.com/openshift/hive/pkg/apis/hive/v1"
hiveinternalv1alpha1 "github.com/openshift/hive/pkg/apis/hiveinternal/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -32,6 +31,7 @@ import (
"k8s.io/klog"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
ctrlruntimelog "sigs.k8s.io/controller-runtime/pkg/log"
)

var (
Expand Down Expand Up @@ -77,6 +77,7 @@ func Run(o *options.ControllerRunOptions, stopCh <-chan struct{}) error {
LeaderElectionID: "foundation-controller",
LeaderElection: o.EnableLeaderElection,
HealthProbeBindAddress: ":8000",
Logger: ctrlruntimelog.NullLogger{},
})
if err != nil {
klog.Errorf("unable to start manager: %v", err)
Expand Down

0 comments on commit 779455d

Please sign in to comment.