From d321badb5cb8fdb8c0202469592550cecef421ca Mon Sep 17 00:00:00 2001 From: Shoaeb Jindani Date: Fri, 5 Apr 2024 11:53:05 +0530 Subject: [PATCH] code cleanup --- controllers/ibpconsole/ibpconsole_controller.go | 1 - controllers/ibporderer/ibporderer_controller.go | 1 - controllers/ibppeer/ibppeer_controller.go | 1 - integration/operator.go | 6 ------ main.go | 3 +-- pkg/command/operator.go | 4 +--- 6 files changed, 2 insertions(+), 14 deletions(-) diff --git a/controllers/ibpconsole/ibpconsole_controller.go b/controllers/ibpconsole/ibpconsole_controller.go index 9041ca90..df656940 100644 --- a/controllers/ibpconsole/ibpconsole_controller.go +++ b/controllers/ibpconsole/ibpconsole_controller.go @@ -153,7 +153,6 @@ type ReconcileIBPConsole struct { func (r *ReconcileIBPConsole) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { var err error - //reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name) reqLogger := r.Config.Logger reqLogger.Info(fmt.Sprintf("Reconciling IBPConsole with update values of [ %+v ]", r.update.GetUpdateStackWithTrues())) diff --git a/controllers/ibporderer/ibporderer_controller.go b/controllers/ibporderer/ibporderer_controller.go index eddee105..19f06bb6 100644 --- a/controllers/ibporderer/ibporderer_controller.go +++ b/controllers/ibporderer/ibporderer_controller.go @@ -183,7 +183,6 @@ type ReconcileIBPOrderer struct { func (r *ReconcileIBPOrderer) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { var err error - //reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name) reqLogger := r.Config.Logger // If orderer-restart-config configmap is the object being reconciled, reconcile the // restart configmap. diff --git a/controllers/ibppeer/ibppeer_controller.go b/controllers/ibppeer/ibppeer_controller.go index 4be2ff61..c5d96883 100644 --- a/controllers/ibppeer/ibppeer_controller.go +++ b/controllers/ibppeer/ibppeer_controller.go @@ -203,7 +203,6 @@ type ReconcileIBPPeer struct { func (r *ReconcileIBPPeer) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { var err error - //reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name) reqLogger := r.Config.Logger // If peer-restart-config configmap is the object being reconciled, reconcile the // restart configmap. diff --git a/integration/operator.go b/integration/operator.go index 7ee7017f..dab8cba4 100644 --- a/integration/operator.go +++ b/integration/operator.go @@ -38,12 +38,6 @@ import ( // GetOperatorConfig returns the operator configuration with the default templating files population // and with default versions set for components. func GetOperatorConfig(configs, caFiles, peerFiles, ordererFiles, consoleFiles string) *config.Config { - // ulevel := uzap.NewAtomicLevelAt(2) - // if os.Getenv("LOG_LEVEL") == "debug" { - // ulevel = uzap.NewAtomicLevelAt(-1) - // } - // level := zap.Level(&ulevel) - // logger := zap.New(zap.Opts(level)) zaplogger, err := util.SetupLogging("DEBUG") if err != nil { fmt.Print("error initiating the logger", err) diff --git a/main.go b/main.go index 48236d81..4aa1acf1 100644 --- a/main.go +++ b/main.go @@ -86,7 +86,7 @@ func main() { time.Sleep(15 * time.Second) } - // // TODO + // TODO // if err = (&ibpca.IBPCAReconciler{ // Client: mgr.GetClient(), // Log: ctrl.Log.WithName("controllers").WithName("IBPCA"), @@ -123,7 +123,6 @@ func main() { } func setDefaultCADefinitions(cfg *config.Config) { - cfg.CAInitConfig = &cainit.Config{ CADefaultConfigPath: filepath.Join(defaultConfigs, "ca/ca.yaml"), TLSCADefaultConfigPath: filepath.Join(defaultConfigs, "ca/tlsca.yaml"), diff --git a/pkg/command/operator.go b/pkg/command/operator.go index b910e61d..d826b195 100644 --- a/pkg/command/operator.go +++ b/pkg/command/operator.go @@ -111,12 +111,10 @@ func OperatorWithSignal(operatorCfg *oconfig.Config, signalHandler context.Conte config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder logger, err := config.Build() if err != nil { - panic(fmt.Sprintf("failed to initialize logger: %v", err)) + fmt.Sprintf("failed to initialize logger: %v", err) } - // Wrap the zap.Logger with go-logr/zapr to satisfy the logr.Logger interface log := zapr.NewLogger(logger) - logf.SetLogger(log) ctrl.SetLogger(log) } else {