Skip to content

Commit

Permalink
Fix klog cant use V module
Browse files Browse the repository at this point in the history
The side affect of this commit is glog's V module not work.
  • Loading branch information
halfcrazy committed Apr 28, 2019
1 parent 8715566 commit 657470c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func ParseFlags() (*Configuration, error) {
argClusterUdpLoadBalancer = pflag.String("cluster-udp-loadbalancer", "cluster-udp-loadbalancer", "The name for cluster udp loadbalancer")
)

flag.Set("alsologtostderr", "true")

klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
klog.InitFlags(klogFlags)

Expand All @@ -72,8 +74,10 @@ func ParseFlags() (*Configuration, error) {
}
})

pflag.CommandLine.AddGoFlagSet(klogFlags)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()

config := &Configuration{
OvnNbSocket: *argOvnNbSocket,
OvnNbHost: *argOvnNbHost,
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (c *Controller) enqueueAddEndpoint(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue add endpoint %s", key)
klog.V(3).Infof("enqueue add endpoint %s", key)
c.updateEndpointQueue.AddRateLimited(key)
}

Expand All @@ -45,7 +45,7 @@ func (c *Controller) enqueueUpdateEndpoint(old, new interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue update endpoint %s", key)
klog.V(3).Infof("enqueue update endpoint %s", key)
c.updateEndpointQueue.AddRateLimited(key)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (c *Controller) enqueueAddNamespace(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue add namespace %s", key)
klog.V(3).Infof("enqueue add namespace %s", key)
c.addNamespaceQueue.AddRateLimited(key)
}

Expand All @@ -37,7 +37,7 @@ func (c *Controller) enqueueDeleteNamespace(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue delete namespace %s", key)
klog.V(3).Infof("enqueue delete namespace %s", key)
c.deleteNamespaceQueue.AddRateLimited(key)
}

Expand All @@ -58,7 +58,7 @@ func (c *Controller) enqueueUpdateNamespace(old, new interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue update namespace %s", key)
klog.V(3).Infof("enqueue update namespace %s", key)
c.updateNamespaceQueue.AddRateLimited(key)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c *Controller) enqueueAddNode(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue add node %s", key)
klog.V(3).Infof("enqueue add node %s", key)
c.addNodeQueue.AddRateLimited(key)
}

Expand All @@ -39,7 +39,7 @@ func (c *Controller) enqueueDeleteNode(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue delete node %s", key)
klog.V(3).Infof("enqueue delete node %s", key)
c.deleteNodeQueue.AddRateLimited(key)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (c *Controller) enqueueAddPod(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue add pod %s", key)
klog.V(3).Infof("enqueue add pod %s", key)
c.addPodQueue.AddRateLimited(key)
}

Expand All @@ -44,7 +44,7 @@ func (c *Controller) enqueueDeletePod(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue delete pod %s", key)
klog.V(3).Infof("enqueue delete pod %s", key)
c.deletePodQueue.AddRateLimited(key)
}

Expand All @@ -65,7 +65,7 @@ func (c *Controller) enqueueUpdatePod(oldObj, newObj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue update pod %s", key)
klog.V(3).Infof("enqueue update pod %s", key)
c.updatePodQueue.AddRateLimited(key)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (c *Controller) enqueueAddService(obj interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue add service %s", key)
klog.V(3).Infof("enqueue add service %s", key)
c.addServiceQueue.AddRateLimited(key)
}

Expand All @@ -42,7 +42,7 @@ func (c *Controller) enqueueUpdateService(old, new interface{}) {
utilruntime.HandleError(err)
return
}
klog.V(5).Infof("enqueue update service %s", key)
klog.V(3).Infof("enqueue update service %s", key)
c.updateServiceQueue.AddRateLimited(key)
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func ParseFlags() (*Configuration, error) {
argServiceClusterIPRange = pflag.String("service-cluster-ip-range", "10.96.0.0/12", "The kubernetes service cluster ip range")
)

flag.Set("alsologtostderr", "true")

klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
klog.InitFlags(klogFlags)

Expand All @@ -44,6 +46,7 @@ func ParseFlags() (*Configuration, error) {
}
})

pflag.CommandLine.AddGoFlagSet(klogFlags)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()

Expand Down
6 changes: 3 additions & 3 deletions pkg/daemon/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ LOOP:
klog.Info("exit gateway")
break LOOP
case <-ticker.C:
klog.V(5).Info("tick")
klog.V(3).Info("tick")
}
subnets, err := c.getSubnets()
if err != nil {
Expand Down Expand Up @@ -141,7 +141,7 @@ func (c *Controller) getLocalPodIPsNeedNAT() ([]string, error) {
}
}
}
klog.V(5).Infof("local pod ips %v", localPodIPs)
klog.V(3).Infof("local pod ips %v", localPodIPs)
return localPodIPs, nil
}

Expand All @@ -157,6 +157,6 @@ func (c *Controller) getSubnets() ([]string, error) {
subnets = append(subnets, subnet)
}
}
klog.V(5).Infof("subnets %v", subnets)
klog.V(3).Infof("subnets %v", subnets)
return subnets, nil
}

0 comments on commit 657470c

Please sign in to comment.