Skip to content

Commit 0c7f2ee

Browse files
authored
add logger config to CNS config
Signed-off-by: Evan Baker <[email protected]>
1 parent 27e3d66 commit 0c7f2ee

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cns/configuration/configuration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/Azure/azure-container-networking/cns"
1212
"github.com/Azure/azure-container-networking/cns/logger"
13+
loggerv2 "github.com/Azure/azure-container-networking/cns/logger/v2"
1314
"github.com/Azure/azure-container-networking/common"
1415
"github.com/pkg/errors"
1516
)
@@ -37,6 +38,7 @@ type CNSConfig struct {
3738
EnableSwiftV2 bool
3839
InitializeFromCNI bool
3940
KeyVaultSettings KeyVaultSettings
41+
Logger loggerv2.Config
4042
MSISettings MSISettings
4143
ManageEndpointState bool
4244
ManagedSettings ManagedSettings

cns/service/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import (
6767
"github.com/Azure/azure-container-networking/store"
6868
"github.com/Azure/azure-container-networking/telemetry"
6969
"github.com/avast/retry-go/v4"
70+
"github.com/go-logr/zapr"
7071
"github.com/google/go-cmp/cmp"
7172
"github.com/pkg/errors"
7273
"go.uber.org/zap"
@@ -84,7 +85,6 @@ import (
8485
"sigs.k8s.io/controller-runtime/pkg/client"
8586
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
8687
"sigs.k8s.io/controller-runtime/pkg/healthz"
87-
ctrlzap "sigs.k8s.io/controller-runtime/pkg/log/zap"
8888
ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager"
8989
ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/metrics/server"
9090
)
@@ -629,7 +629,7 @@ func main() {
629629
}
630630

631631
// build the zap logger
632-
z, c, err := loggerv2.New(&loggerv2.Config{})
632+
z, c, err := loggerv2.New(&cnsconfig.Logger)
633633
defer c()
634634
if err != nil {
635635
fmt.Printf("failed to create logger: %v", err)
@@ -1515,7 +1515,7 @@ func InitializeCRDState(ctx context.Context, z *zap.Logger, httpRestService cns.
15151515
Scheme: scheme,
15161516
Metrics: ctrlmetrics.Options{BindAddress: "0"},
15171517
Cache: cacheOpts,
1518-
Logger: ctrlzap.New(),
1518+
Logger: zapr.NewLogger(z),
15191519
}
15201520

15211521
manager, err := ctrl.NewManager(kubeConfig, managerOpts)

0 commit comments

Comments
 (0)