From 98cd96312e1fb2f49fd2a368e1dd313a3dd16f81 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 7 Jan 2025 16:11:36 +0200 Subject: [PATCH] Drop setup of grpc logging --- cmd/nfd-master/main.go | 3 -- cmd/nfd-topology-updater/main.go | 4 -- cmd/nfd-worker/main.go | 3 -- pkg/utils/grpc_log.go | 84 -------------------------------- 4 files changed, 94 deletions(-) delete mode 100644 pkg/utils/grpc_log.go diff --git a/cmd/nfd-master/main.go b/cmd/nfd-master/main.go index 029926cd88..cec1a0b830 100644 --- a/cmd/nfd-master/main.go +++ b/cmd/nfd-master/main.go @@ -86,9 +86,6 @@ func main() { klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always --match 'v*'`\" during build or run.") } - // Plug klog into grpc logging infrastructure - utils.ConfigureGrpcKlog() - // Get new NfdMaster instance instance, err := master.NewNfdMaster(master.WithArgs(args)) if err != nil { diff --git a/cmd/nfd-topology-updater/main.go b/cmd/nfd-topology-updater/main.go index 89fe8c57ec..c59432ec59 100644 --- a/cmd/nfd-topology-updater/main.go +++ b/cmd/nfd-topology-updater/main.go @@ -29,7 +29,6 @@ import ( topology "sigs.k8s.io/node-feature-discovery/pkg/nfd-topology-updater" "sigs.k8s.io/node-feature-discovery/pkg/resourcemonitor" - "sigs.k8s.io/node-feature-discovery/pkg/utils" "sigs.k8s.io/node-feature-discovery/pkg/utils/hostpath" "sigs.k8s.io/node-feature-discovery/pkg/version" ) @@ -52,9 +51,6 @@ func main() { klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always --match 'v*'`\" during build or run.") } - // Plug klog into grpc logging infrastructure - utils.ConfigureGrpcKlog() - // Get new TopologyUpdater instance instance, err := topology.NewTopologyUpdater(*args, *resourcemonitorArgs) if err != nil { diff --git a/cmd/nfd-worker/main.go b/cmd/nfd-worker/main.go index d19d3624bb..c92bfab1fe 100644 --- a/cmd/nfd-worker/main.go +++ b/cmd/nfd-worker/main.go @@ -59,9 +59,6 @@ func main() { klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always --match 'v*'`\" during build or run.") } - // Plug klog into grpc logging infrastructure - utils.ConfigureGrpcKlog() - // Get new NfdWorker instance instance, err := worker.NewNfdWorker(worker.WithArgs(args)) if err != nil { diff --git a/pkg/utils/grpc_log.go b/pkg/utils/grpc_log.go deleted file mode 100644 index f8c8bf0ae1..0000000000 --- a/pkg/utils/grpc_log.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package utils - -import ( - "fmt" - - "google.golang.org/grpc/grpclog" - "k8s.io/klog/v2" -) - -// ConfigureGrpcKlog wraps grpc logging to use klog -func ConfigureGrpcKlog() { - grpclog.SetLoggerV2(new(grpcLogger)) -} - -// grpcLogger implements the LoggerV2 interface from grpclog -type grpcLogger struct{} - -func (g grpcLogger) Error(args ...interface{}) { - klog.ErrorDepth(2, args...) -} - -func (g grpcLogger) Errorf(format string, args ...interface{}) { - klog.ErrorDepth(2, fmt.Sprintf(format, args...)) -} - -func (g grpcLogger) Errorln(args ...interface{}) { - klog.ErrorDepth(2, args...) -} - -func (g grpcLogger) Fatal(args ...interface{}) { - klog.FatalDepth(2, args...) -} - -func (g grpcLogger) Fatalf(format string, args ...interface{}) { - klog.FatalDepth(2, fmt.Sprintf(format, args...)) -} - -func (g grpcLogger) Fatalln(args ...interface{}) { - klog.FatalDepth(2, args...) -} - -func (g grpcLogger) Info(args ...interface{}) { - klog.InfoDepth(2, args...) -} - -func (g grpcLogger) Infof(format string, args ...interface{}) { - klog.InfoDepth(2, fmt.Sprintf(format, args...)) -} - -func (g grpcLogger) Infoln(args ...interface{}) { - klog.InfoDepth(2, args...) -} - -func (g grpcLogger) Warning(args ...interface{}) { - klog.WarningDepth(2, args...) -} - -func (g grpcLogger) Warningf(format string, args ...interface{}) { - klog.WarningDepth(2, fmt.Sprintf(format, args...)) -} - -func (g grpcLogger) Warningln(args ...interface{}) { - klog.WarningDepth(2, args...) -} - -func (g grpcLogger) V(l int) bool { - return klog.V(klog.Level(l)).Enabled() -}