Skip to content

Commit

Permalink
Merge pull request #1 from raunakkumar/logger-update
Browse files Browse the repository at this point in the history
update logger to use logrus
  • Loading branch information
raunakkumar authored Aug 22, 2019
2 parents d7cb419 + ea1fd40 commit 1922586
Show file tree
Hide file tree
Showing 11 changed files with 408 additions and 271 deletions.
Binary file removed build/k8s-dynamic-provisioner
Binary file not shown.
12 changes: 7 additions & 5 deletions cmd/dynamic-provisioner/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"syscall"

csi_spec "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/hpe-storage/common-host-libs/util"
log "github.com/hpe-storage/common-host-libs/logger"
crd_client "github.com/hpe-storage/k8s-custom-resources/pkg/client/clientset/versioned"
"github.com/hpe-storage/k8s-dynamic-provisioner/pkg/provisioner"
snap_client "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned"
Expand All @@ -33,12 +33,14 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
csi_client "k8s.io/csi-api/pkg/client/clientset/versioned"

"k8s.io/klog"
)

var (
// init to empty as we always want to get this from env variable
csiEndpoint = flag.String("endpoint", "", "Address of the CSI driver socket.")
logFilePath = "/var/log/hpe-dynamic-provisioner.log"
)

// nolint: gocyclo
Expand Down Expand Up @@ -104,12 +106,12 @@ func main() {
if provisioner.CsiEndpoint != "" {
csiDriverClient, err = provisioner.GetCsiDriverClient()
if err != nil {
util.LogError.Printf("Error getting csi driver client for %s - %s", provisioner.CsiProvisioner, err.Error())
log.Errorf("Error getting csi driver client for %s - %s", provisioner.CsiProvisioner, err.Error())
os.Exit(1)
}
}

util.OpenLog(true)
log.InitLogging(logFilePath, &log.LogParams{Level: "debug"}, false)

stop := make(chan struct{})

Expand Down Expand Up @@ -143,12 +145,12 @@ func main() {
syscall.SIGSEGV)
go func() {
s := <-sigc
util.LogError.Fatalf("Exiting due to signal notification. Signal was %v.", s.String())
log.Fatalf("Exiting due to signal notification. Signal was %v.", s.String())
return
}()
select {
case msg := <-stop:
util.LogError.Printf("error in provisioner: %#v", msg)
log.Errorf("error in provisioner: %#v", msg)
}
<-stop
}
39 changes: 21 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/hpe-storage/k8s-dynamic-provisioner

require (
cloud.google.com/go v0.43.0 // indirect
cloud.google.com/go v0.44.3 // indirect
github.com/OpenPeeDeeP/depguard v1.0.0 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/container-storage-interface/spec v1.1.0
github.com/coreos/bbolt v1.3.3 // indirect
github.com/coreos/etcd v3.3.13+incompatible // indirect
github.com/coreos/etcd v3.3.15+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/fatih/color v1.7.0 // indirect
Expand All @@ -22,32 +22,35 @@ require (
github.com/golangci/gosec v0.0.0-20180901114220-8afd9cbb6cfb // indirect
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219 // indirect
github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/google/pprof v0.0.0-20190723021845-34ac40c74b70 // indirect
github.com/gorilla/mux v1.7.2 // indirect
github.com/gostaticanalysis/analysisutil v0.0.2 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.9.5 // indirect
github.com/gostaticanalysis/analysisutil v0.0.3 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.9.6 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/hpe-storage/common-host-libs v0.0.0-20190729230508-ed4df55bd64a
github.com/hpe-storage/common-host-libs v0.0.0-20190821160716-b46821a0b5d1
github.com/hpe-storage/k8s-custom-resources v0.0.0-20190725185337-965fa924678a
github.com/imdario/mergo v0.3.7 // indirect
github.com/json-iterator/go v1.1.7 // indirect
github.com/kisielk/errcheck v1.2.0 // indirect
github.com/klauspost/compress v1.7.4 // indirect
github.com/klauspost/compress v1.7.6 // indirect
github.com/klauspost/cpuid v1.2.1 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.6.1
github.com/kubernetes-csi/external-snapshotter v1.1.0
github.com/logrusorgru/aurora v0.0.0-20190428105938-cea283e61946 // indirect
github.com/logrusorgru/aurora v0.0.0-20190803045625-94edacc10f9b // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
github.com/onsi/ginkgo v1.9.0 // indirect
github.com/onsi/gomega v1.6.0 // indirect
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/prometheus/common v0.6.0 // indirect
github.com/prometheus/procfs v0.0.3 // indirect
github.com/prometheus/client_golang v1.1.0 // indirect
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/satori/go.uuid v1.2.0
Expand All @@ -58,18 +61,18 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.4.0 // indirect
github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec // indirect
github.com/ugorji/go v1.1.7 // indirect
github.com/valyala/fasthttp v1.4.0 // indirect
go.etcd.io/bbolt v1.3.3 // indirect
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
golang.org/x/exp v0.0.0-20190718202018-cfdd5522f6f6 // indirect
golang.org/x/image v0.0.0-20190729225735-1bd0cf576493 // indirect
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 // indirect
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e // indirect
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a // indirect
google.golang.org/grpc v1.22.1 // indirect
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 // indirect
golang.org/x/mobile v0.0.0-20190814143026-e8b3e6111d02 // indirect
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
golang.org/x/tools v0.0.0-20190822000311-fc82fb2afd64 // indirect
google.golang.org/api v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
google.golang.org/grpc v1.23.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
honnef.co/go/tools v0.0.1-2019.2.2 // indirect
k8s.io/api v0.0.0-20190627205229-acea843d18eb
Expand Down
Loading

0 comments on commit 1922586

Please sign in to comment.