Skip to content

Commit

Permalink
Move from glog to klog
Browse files Browse the repository at this point in the history
glog is not under development anymore:
https://github.com/kubernetes/klog/blob/master/README.md#why-was-klog-created

Signed-off-by: Manuel Buil <mbuil@suse.com>
  • Loading branch information
manuelbuil committed Jan 8, 2021
1 parent 1c0d9b3 commit 31dbe1c
Show file tree
Hide file tree
Showing 35 changed files with 80 additions and 92 deletions.
2 changes: 1 addition & 1 deletion Documentation/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This problems manifests itself as connectivity problems between containers runni


## Logging
Flannel uses the `glog` library but only supports logging to stderr. The severity level can't be changed but the verbosity can be changed with the `-v` option. Flannel does not make extensive use of the verbosity level but increasing the value from `0` (the default) will result in some additional logs. To get the most detailed logs, use `-v=10`
Flannel uses the `klog` library but only supports logging to stderr. The severity level can't be changed but the verbosity can be changed with the `-v` option. Flannel does not make extensive use of the verbosity level but increasing the value from `0` (the default) will result in some additional logs. To get the most detailed logs, use `-v=10`

```
-v value
Expand Down
2 changes: 1 addition & 1 deletion backend/alivpc/alivpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package alivpc
import (
"encoding/json"
"fmt"
log "github.com/golang/glog"
"golang.org/x/net/context"
"os"
"sync"
Expand All @@ -29,6 +28,7 @@ import (
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/denverdino/aliyungo/metadata"
log "k8s.io/klog"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion backend/alivpc/alivpc_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package alivpc

import (
log "github.com/golang/glog"
log "k8s.io/klog"
)

func init() {
Expand Down
15 changes: 8 additions & 7 deletions backend/awsvpc/awsvpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ package awsvpc
import (
"encoding/json"
"fmt"
"net"
"sync"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
log "github.com/golang/glog"
"golang.org/x/net/context"
"net"
"sync"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/subnet"
log "k8s.io/klog"
)

func init() {
Expand Down Expand Up @@ -60,7 +61,7 @@ func (conf *backendConfig) routeTables() ([]string, error) {
return []string{table}, nil
}
if rawTables, ok := conf.RouteTableID.([]interface{}); ok {
log.Info("RouteTableID configured as slice: %+v", rawTables)
log.Infof("RouteTableID configured as slice: %+v", rawTables)
tables := make([]string, len(rawTables))
for idx, t := range rawTables {
table, ok := t.(string)
Expand All @@ -85,7 +86,7 @@ func (be *AwsVpcBackend) RegisterNetwork(ctx context.Context, wg *sync.WaitGroup
var cfg backendConfig

if len(config.Backend) > 0 {
log.Info("Backend configured as: %s", string(config.Backend))
log.Infof("Backend configured as: %s", string(config.Backend))
if err := json.Unmarshal(config.Backend, &cfg); err != nil {
return nil, fmt.Errorf("error decoding VPC backend config: %v", err)
}
Expand Down Expand Up @@ -200,7 +201,7 @@ func (be *AwsVpcBackend) cleanupBlackholeRoutes(routeTableID string, network ip.
if *route.State == "blackhole" && route.DestinationCidrBlock != nil {
_, subnet, err := net.ParseCIDR(*route.DestinationCidrBlock)
if err == nil && network.Contains(ip.FromIP(subnet.IP)) {
log.Info("Removing blackhole route: ", *route.DestinationCidrBlock)
log.Infof("Removing blackhole route: ", *route.DestinationCidrBlock)
deleteRouteInput := &ec2.DeleteRouteInput{RouteTableId: &routeTableID, DestinationCidrBlock: route.DestinationCidrBlock}
if _, err := ec2c.DeleteRoute(deleteRouteInput); err != nil {
if ec2err, ok := err.(awserr.Error); !ok || ec2err.Code() != "InvalidRoute.NotFound" {
Expand Down Expand Up @@ -298,7 +299,7 @@ func (be *AwsVpcBackend) detectRouteTableID(eni *ec2.InstanceNetworkInterface, e

res, err = ec2c.DescribeRouteTables(routeTablesInput)
if err != nil {
log.Info("error describing route tables: ", err)
log.Infof("error describing route tables: ", err)
}

if len(res.RouteTables) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion backend/awsvpc/awsvpc_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package awsvpc

import (
log "github.com/golang/glog"
log "k8s.io/klog"
)

func init() {
Expand Down
3 changes: 1 addition & 2 deletions backend/extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import (
"os/exec"
"sync"

log "github.com/golang/glog"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/subnet"
"golang.org/x/net/context"
log "k8s.io/klog"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion backend/extension/extension_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import (
"encoding/json"
"sync"

log "github.com/golang/glog"
"golang.org/x/net/context"

"fmt"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/subnet"
log "k8s.io/klog"
)

type network struct {
Expand Down
3 changes: 1 addition & 2 deletions backend/gce/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import (
"fmt"
"time"

log "github.com/golang/glog"

"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/compute/v1"
log "k8s.io/klog"
)

type gceAPI struct {
Expand Down
6 changes: 3 additions & 3 deletions backend/gce/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ package gce

import (
"fmt"
log "github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/api/googleapi"
"strings"
"sync"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/subnet"
"golang.org/x/net/context"
"google.golang.org/api/googleapi"
log "k8s.io/klog"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion backend/gce/gce_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
package gce

import (
log "github.com/golang/glog"
log "k8s.io/klog"
)

func init() {
Expand Down
11 changes: 5 additions & 6 deletions backend/hostgw/hostgw_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ import (
"time"

"github.com/Microsoft/hcsshim"
log "github.com/golang/glog"
"github.com/pkg/errors"
"golang.org/x/net/context"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/util/wait"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/pkg/routing"
"github.com/coreos/flannel/subnet"
"github.com/pkg/errors"
"golang.org/x/net/context"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/util/wait"
log "k8s.io/klog"
)

func init() {
Expand Down
5 changes: 2 additions & 3 deletions backend/ipip/ipip.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ package ipip
import (
"encoding/json"
"fmt"
"syscall"

"sync"
"syscall"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/subnet"
log "github.com/golang/glog"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
log "k8s.io/klog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion backend/ipip/ipip_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package ipip

import (
log "github.com/golang/glog"
log "k8s.io/klog"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion backend/ipsec/handle_charon.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (

"github.com/bronze1man/goStrongswanVici"
"github.com/coreos/flannel/subnet"
log "github.com/golang/glog"
"golang.org/x/net/context"
log "k8s.io/klog"
)

type Uri struct {
Expand Down
5 changes: 2 additions & 3 deletions backend/ipsec/handle_xfrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import (
"net"
"syscall"

log "github.com/golang/glog"
"github.com/vishvananda/netlink"

"github.com/coreos/flannel/subnet"
"github.com/vishvananda/netlink"
log "k8s.io/klog"
)

func AddXFRMPolicy(myLease, remoteLease *subnet.Lease, dir netlink.Dir, reqID int) error {
Expand Down
2 changes: 1 addition & 1 deletion backend/ipsec/ipsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
"fmt"
"sync"

log "github.com/golang/glog"
"golang.org/x/net/context"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/subnet"
log "k8s.io/klog"
)

/*
Expand Down
7 changes: 3 additions & 4 deletions backend/ipsec/ipsec_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import (
"strconv"
"sync"

log "github.com/golang/glog"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/subnet"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
log "k8s.io/klog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion backend/ipsec/ipsec_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package ipsec

import log "github.com/golang/glog"
import log "k8s.io/klog"

func init() {
log.Infof("ipsec is not supported on this platform")
Expand Down
2 changes: 1 addition & 1 deletion backend/route_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"sync"
"time"

log "github.com/golang/glog"
"golang.org/x/net/context"

"github.com/coreos/flannel/subnet"
"github.com/vishvananda/netlink"
log "k8s.io/klog"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions backend/route_network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
package backend

import (
"strings"
"sync"
"time"

log "github.com/golang/glog"
"golang.org/x/net/context"

"github.com/coreos/flannel/pkg/routing"
"github.com/coreos/flannel/subnet"
"strings"
log "k8s.io/klog"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions backend/udp/cproxy_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ import (
"reflect"
"unsafe"

log "github.com/golang/glog"

"github.com/coreos/flannel/pkg/ip"
log "k8s.io/klog"
)

func runCProxy(tun *os.File, conn *net.UDPConn, ctl *os.File, tunIP ip.IP4, tunMTU int) {
Expand Down
4 changes: 2 additions & 2 deletions backend/udp/udp_network_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
"sync"
"syscall"

log "github.com/golang/glog"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"

"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/subnet"
"github.com/vishvananda/netlink"
log "k8s.io/klog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion backend/udp/udp_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package udp

import (
log "github.com/golang/glog"
log "k8s.io/klog"
)

func init() {
Expand Down
5 changes: 2 additions & 3 deletions backend/vxlan/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import (
"net"
"syscall"

log "github.com/golang/glog"
"github.com/vishvananda/netlink"

"github.com/containernetworking/plugins/pkg/utils/sysctl"
"github.com/coreos/flannel/pkg/ip"
"github.com/vishvananda/netlink"
log "k8s.io/klog"
)

type vxlanDeviceAttrs struct {
Expand Down
2 changes: 1 addition & 1 deletion backend/vxlan/device_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (

"github.com/Microsoft/hcsshim/hcn"
"github.com/coreos/flannel/pkg/ip"
log "github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/wait"
log "k8s.io/klog"
)

type vxlanDeviceAttrs struct {
Expand Down
2 changes: 1 addition & 1 deletion backend/vxlan/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ package vxlan
import (
"encoding/json"
"fmt"
log "github.com/golang/glog"
"net"
"sync"

Expand All @@ -64,6 +63,7 @@ import (
"github.com/coreos/flannel/backend"
"github.com/coreos/flannel/pkg/ip"
"github.com/coreos/flannel/subnet"
log "k8s.io/klog"
)

func init() {
Expand Down
Loading

0 comments on commit 31dbe1c

Please sign in to comment.