mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-30 10:10:21 +00:00
util: replace klog with util logger in liveness.go
replace klog with util logger in liveness.go
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 27d2cc644d
)
This commit is contained in:
parent
2fe86bbc4b
commit
b2a9ecf5e5
@ -27,7 +27,6 @@ import (
|
|||||||
"github.com/kubernetes-csi/csi-lib-utils/rpc"
|
"github.com/kubernetes-csi/csi-lib-utils/rpc"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
klog "k8s.io/klog/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -46,13 +45,13 @@ func getLiveness(timeout time.Duration, csiConn *grpc.ClientConn) {
|
|||||||
ready, err := rpc.Probe(ctx, csiConn)
|
ready, err := rpc.Probe(ctx, csiConn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
liveness.Set(0)
|
liveness.Set(0)
|
||||||
klog.Errorf("health check failed: %v", err)
|
util.ErrorLogMsg("health check failed: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ready {
|
if !ready {
|
||||||
liveness.Set(0)
|
liveness.Set(0)
|
||||||
klog.Error("driver responded but is not ready")
|
util.ErrorLogMsg("driver responded but is not ready")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
liveness.Set(1)
|
liveness.Set(1)
|
||||||
@ -64,14 +63,14 @@ func recordLiveness(endpoint, drivername string, pollTime, timeout time.Duration
|
|||||||
// register prometheus metrics
|
// register prometheus metrics
|
||||||
err := prometheus.Register(liveness)
|
err := prometheus.Register(liveness)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Fatalln(err)
|
util.FatalLogMsg(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
csiConn, err := connlib.Connect(endpoint, liveMetricsManager)
|
csiConn, err := connlib.Connect(endpoint, liveMetricsManager)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// connlib should retry forever so a returned error should mean
|
// connlib should retry forever so a returned error should mean
|
||||||
// the grpc client is misconfigured rather than an error on the network
|
// the grpc client is misconfigured rather than an error on the network
|
||||||
klog.Fatalf("failed to establish connection to CSI driver: %v", err)
|
util.FatalLogMsg("failed to establish connection to CSI driver: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get liveness periodically
|
// get liveness periodically
|
||||||
|
Loading…
Reference in New Issue
Block a user