Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit c256a2b

Browse files
author
Krish Chowdhary
committed
move to klog, and refactoring around error handling
1 parent 99c9376 commit c256a2b

File tree

9 files changed

+106
-193
lines changed

9 files changed

+106
-193
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
COSI repos and images:
22

33
[Spec](https://github.com/kubernetes-sigs/container-object-storage-interface-spec) \
4-
[API](https://github.com/kubernetes-sigs/container-object-storage-interface-api) \
4+
[API](https://sigs.k8s.io/container-object-storage-interface-api) \
55
[Controller](https://github.com/kubernetes-sigs/container-object-storage-interface-controller) <br/>
66
&emsp; - [images: cosi-controller](https://quay.io/repository/containerobjectstorage/objectstorage-controller?tab=tags) \
77
[Provisioner Sidecar](https://github.com/kubernetes-sigs/container-object-storage-interface-provisioner-sidecar) <br />

cmd/csi-adapter/cmd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"flag"
2121
"os"
2222

23-
_ "github.com/golang/glog"
2423
"github.com/spf13/cobra"
2524
"github.com/spf13/viper"
25+
_ "k8s.io/klog/v2"
2626
)
2727

2828
var Version string
@@ -51,7 +51,7 @@ func init() {
5151
Version = "v0.0.1"
5252

5353
viper.AutomaticEnv()
54-
// parse the go default flagset to get flags for glog and other packages in future
54+
// parse the go default flagset to get flags for klog and other packages in future
5555
driverCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)
5656
// defaulting this to true so that logs are printed to console
5757
_ = flag.Set("logtostderr", "true")
@@ -71,7 +71,7 @@ func init() {
7171
_ = driverCmd.PersistentFlags().MarkHidden("stderrthreshold")
7272
_ = driverCmd.PersistentFlags().MarkHidden("vmodule")
7373

74-
// suppress the incorrect prefix in glog output
74+
// suppress the incorrect prefix in klog output
7575
_ = flag.CommandLine.Parse([]string{})
7676
_ = viper.BindPFlags(driverCmd.PersistentFlags())
7777
}

cmd/csi-adapter/driver.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ package main
1919
import (
2020
"os"
2121

22-
"github.com/golang/glog"
2322
csicommon "github.com/kubernetes-csi/drivers/pkg/csi-common"
24-
"k8s.io/klog"
23+
"k8s.io/klog/v2"
2524

26-
"github.com/kubernetes-sigs/container-object-storage-interface-csi-adapter/pkg/controller"
27-
id "github.com/kubernetes-sigs/container-object-storage-interface-csi-adapter/pkg/identity"
28-
"github.com/kubernetes-sigs/container-object-storage-interface-csi-adapter/pkg/node"
25+
"sigs.k8s.io/container-object-storage-interface-csi-adapter/pkg/controller"
26+
id "sigs.k8s.io/container-object-storage-interface-csi-adapter/pkg/identity"
27+
"sigs.k8s.io/container-object-storage-interface-csi-adapter/pkg/node"
2928
)
3029

3130
func driver(args []string) error {
32-
3331
if protocol == "unix" {
3432
if err := os.RemoveAll(listen); err != nil {
3533
klog.Fatalf("could not prepare socket: %v", err)
@@ -40,7 +38,7 @@ func driver(args []string) error {
4038
if err != nil {
4139
return err
4240
}
43-
glog.V(5).Infof("identity server prepared")
41+
klog.InfoS("identity server prepared")
4442

4543
nodeServer := node.NewNodeServerOrDie(identity, nodeID, dataRoot, volumeLimit)
4644
controllerServer, err := controller.NewControllerServer()

cmd/csi-adapter/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"os/signal"
2222
"syscall"
2323

24-
"github.com/golang/glog"
24+
"k8s.io/klog/v2"
2525
)
2626

2727
func main() {
@@ -30,7 +30,7 @@ func main() {
3030

3131
go func() {
3232
s := <-sigs
33-
glog.Infof("Exiting on signal %s %#v", s.String(), s)
33+
klog.InfoS("Exiting on signal", "signal", s.String(), "value", s)
3434
}()
3535

3636
if err := Execute(); err != nil {

go.mod

+11-29
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,19 @@
1-
module github.com/kubernetes-sigs/container-object-storage-interface-csi-adapter
1+
module sigs.k8s.io/container-object-storage-interface-csi-adapter
22

33
go 1.15
44

55
require (
66
github.com/container-storage-interface/spec v1.3.0
7-
github.com/emicklei/go-restful v2.14.2+incompatible // indirect
8-
github.com/go-logr/logr v0.2.1 // indirect
9-
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
10-
github.com/google/gofuzz v1.2.0 // indirect
11-
github.com/kubernetes-csi/csi-lib-utils v0.8.1 // indirect
7+
github.com/kubernetes-csi/csi-lib-utils v0.9.1 // indirect
128
github.com/kubernetes-csi/drivers v1.0.2
13-
github.com/kubernetes-sigs/container-object-storage-interface-api v0.0.0-20210126191231-321ababeabd5
14-
github.com/magiconair/properties v1.8.4 // indirect
15-
github.com/mailru/easyjson v0.7.6 // indirect
16-
github.com/mitchellh/mapstructure v1.3.3 // indirect
17-
github.com/pelletier/go-toml v1.8.1 // indirect
18-
github.com/spf13/afero v1.4.0 // indirect
19-
github.com/spf13/cast v1.3.1 // indirect
20-
github.com/spf13/cobra v1.1.1
21-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
9+
github.com/pkg/errors v0.9.1
10+
github.com/spf13/cobra v1.1.3
2211
github.com/spf13/viper v1.7.1
23-
golang.org/x/crypto v0.0.0-20201002094018-c90954cbb977 // indirect
24-
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect
25-
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
26-
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
27-
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
28-
google.golang.org/genproto v0.0.0-20201002142447-3860012362da // indirect
29-
google.golang.org/grpc v1.32.0
30-
gopkg.in/ini.v1 v1.61.0 // indirect
31-
k8s.io/api v0.19.4
32-
k8s.io/apimachinery v0.19.4
33-
k8s.io/client-go v0.19.4
34-
k8s.io/klog v1.0.0
35-
k8s.io/klog/v2 v2.3.0 // indirect
36-
k8s.io/utils v0.0.0-20200912215256-4140de9c8800
12+
google.golang.org/grpc v1.36.0
13+
k8s.io/api v0.20.4
14+
k8s.io/apimachinery v0.20.4
15+
k8s.io/client-go v0.20.0
16+
k8s.io/klog/v2 v2.6.0
17+
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
18+
sigs.k8s.io/container-object-storage-interface-api v0.0.0-20210225042325-7c26b4fc1ed9
3719
)

0 commit comments

Comments
 (0)