Skip to content

Commit

Permalink
Replace github.com/golang/glog with k8s.io/klog/v2
Browse files Browse the repository at this point in the history
glog is effectively unmaintained and the kubernetes ecosystem is mainly
using its fork klog

Fixes: #1051
  • Loading branch information
mrueg authored and aauren committed May 25, 2021
1 parent 162e64d commit 6aa3fa9
Show file tree
Hide file tree
Showing 21 changed files with 440 additions and 438 deletions.
3 changes: 3 additions & 0 deletions cmd/kube-router/kube-router.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/cloudnativelabs/kube-router/pkg/version"
"github.com/spf13/pflag"
"k8s.io/klog/v2"
)

func main() {
Expand All @@ -23,6 +24,8 @@ func main() {
}

func Main() error {
klog.InitFlags(nil)

config := options.NewKubeRouterConfig()
config.AddFlags(pflag.CommandLine)
pflag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/docker/docker v20.10.5+incompatible
github.com/docker/go-connections v0.3.0 // indirect
github.com/docker/go-units v0.3.3 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.4.3
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
github.com/k-sone/critbitgo v1.4.0 // indirect
Expand All @@ -38,6 +37,7 @@ require (
k8s.io/apimachinery v0.20.5
k8s.io/client-go v0.20.5
k8s.io/cri-api v0.20.5
k8s.io/klog/v2 v2.4.0
)

go 1.13
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/kube-router.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/cloudnativelabs/kube-router/pkg/metrics"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/cloudnativelabs/kube-router/pkg/version"
"github.com/golang/glog"
"k8s.io/klog/v2"

"time"

Expand Down Expand Up @@ -78,7 +78,7 @@ func (kr *KubeRouter) Run() error {
stopCh := make(chan struct{})

if !(kr.Config.RunFirewall || kr.Config.RunServiceProxy || kr.Config.RunRouter) {
glog.Info("Router, Firewall or Service proxy functionality must be specified. Exiting!")
klog.Info("Router, Firewall or Service proxy functionality must be specified. Exiting!")
os.Exit(0)
}

Expand Down Expand Up @@ -117,7 +117,7 @@ func (kr *KubeRouter) Run() error {
go mc.Run(healthChan, stopCh, &wg)

} else if kr.Config.MetricsPort > 65535 {
glog.Errorf("Metrics port must be over 0 and under 65535, given port: %d", kr.Config.MetricsPort)
klog.Errorf("Metrics port must be over 0 and under 65535, given port: %d", kr.Config.MetricsPort)
kr.Config.MetricsEnabled = false
} else {
kr.Config.MetricsEnabled = false
Expand Down Expand Up @@ -201,7 +201,7 @@ func (kr *KubeRouter) Run() error {
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
<-ch

glog.Infof("Shutting down the controllers")
klog.Infof("Shutting down the controllers")
close(stopCh)

wg.Wait()
Expand Down
10 changes: 5 additions & 5 deletions pkg/controllers/netpol/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package netpol
import (
"reflect"

"github.com/golang/glog"
api "k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
)

func (npc *NetworkPolicyController) newNamespaceEventHandler() cache.ResourceEventHandler {
Expand All @@ -27,7 +27,7 @@ func (npc *NetworkPolicyController) newNamespaceEventHandler() cache.ResourceEve
return
}
default:
glog.Errorf("unexpected object type: %v", obj)
klog.Errorf("unexpected object type: %v", obj)
}
},
}
Expand All @@ -37,7 +37,7 @@ func (npc *NetworkPolicyController) handleNamespaceAdd(obj *api.Namespace) {
if obj.Labels == nil {
return
}
glog.V(2).Infof("Received update for namespace: %s", obj.Name)
klog.V(2).Infof("Received update for namespace: %s", obj.Name)

npc.RequestFullSync()
}
Expand All @@ -46,7 +46,7 @@ func (npc *NetworkPolicyController) handleNamespaceUpdate(oldObj, newObj *api.Na
if reflect.DeepEqual(oldObj.Labels, newObj.Labels) {
return
}
glog.V(2).Infof("Received update for namespace: %s", newObj.Name)
klog.V(2).Infof("Received update for namespace: %s", newObj.Name)

npc.RequestFullSync()
}
Expand All @@ -55,7 +55,7 @@ func (npc *NetworkPolicyController) handleNamespaceDelete(obj *api.Namespace) {
if obj.Labels == nil {
return
}
glog.V(2).Infof("Received namespace: %s delete event", obj.Name)
klog.V(2).Infof("Received namespace: %s delete event", obj.Name)

npc.RequestFullSync()
}
Loading

0 comments on commit 6aa3fa9

Please sign in to comment.