mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
fixes broken migration to klog
This commit is contained in:
parent
a195856104
commit
1748629de2
@ -26,13 +26,6 @@ import (
|
|||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
if err := flag.Set("logtostderr", "true"); err != nil {
|
|
||||||
klog.Errorf("failed to set logtostderr flag: %v", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
|
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
|
||||||
driverName = flag.String("drivername", "csi-cephfsplugin", "name of the driver")
|
driverName = flag.String("drivername", "csi-cephfsplugin", "name of the driver")
|
||||||
@ -42,8 +35,27 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if err := flag.Set("logtostderr", "true"); err != nil {
|
||||||
|
klog.Errorf("failed to set logtostderr flag: %v", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
// TODO: remove this once github.com/kubernetes-csi/drivers/pkg/csi-common pkg moves to klog
|
||||||
|
klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
|
||||||
|
klog.InitFlags(klogFlags)
|
||||||
|
|
||||||
|
// Sync klog flags with glog
|
||||||
|
flag.CommandLine.VisitAll(func(f1 *flag.Flag) {
|
||||||
|
if f2 := klogFlags.Lookup(f1.Name); f2 != nil {
|
||||||
|
if err := f2.Value.Set(f1.Value.String()); err != nil {
|
||||||
|
klog.Errorf("failed to set %s flag: %v", f1.Name, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if err := createPersistentStorage(path.Join(cephfs.PluginFolder, "controller")); err != nil {
|
if err := createPersistentStorage(path.Join(cephfs.PluginFolder, "controller")); err != nil {
|
||||||
klog.Errorf("failed to create persistent storage for controller: %v", err)
|
klog.Errorf("failed to create persistent storage for controller: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -26,13 +26,6 @@ import (
|
|||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
if err := flag.Set("logtostderr", "true"); err != nil {
|
|
||||||
klog.Errorf("failed to set logtostderr flag: %v", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
|
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
|
||||||
driverName = flag.String("drivername", "csi-rbdplugin", "name of the driver")
|
driverName = flag.String("drivername", "csi-rbdplugin", "name of the driver")
|
||||||
@ -42,8 +35,27 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if err := flag.Set("logtostderr", "true"); err != nil {
|
||||||
|
klog.Errorf("failed to set logtostderr flag: %v", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
// TODO: remove this once github.com/kubernetes-csi/drivers/pkg/csi-common pkg moves to klog
|
||||||
|
klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
|
||||||
|
klog.InitFlags(klogFlags)
|
||||||
|
|
||||||
|
// Sync klog flags with glog
|
||||||
|
flag.CommandLine.VisitAll(func(f1 *flag.Flag) {
|
||||||
|
if f2 := klogFlags.Lookup(f1.Name); f2 != nil {
|
||||||
|
if err := f2.Value.Set(f1.Value.String()); err != nil {
|
||||||
|
klog.Errorf("failed to set %s flag: %v", f1.Name, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if err := createPersistentStorage(path.Join(rbd.PluginFolder, "controller")); err != nil {
|
if err := createPersistentStorage(path.Join(rbd.PluginFolder, "controller")); err != nil {
|
||||||
klog.Errorf("failed to create persistent storage for controller %v", err)
|
klog.Errorf("failed to create persistent storage for controller %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user