Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog - klog as explicit InitFlags() so we add them as necessary - we update the other repositories that we vendor that made a similar change from glog to klog * github.com/kubernetes/repo-infra * k8s.io/gengo/ * k8s.io/kube-openapi/ * github.com/google/cadvisor - Entirely remove all references to glog - Fix some tests by explicit InitFlags in their init() methods Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
This commit is contained in:
@@ -22,7 +22,7 @@ go_library(
|
||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@@ -24,11 +24,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
clientapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
"k8s.io/klog"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||
)
|
||||
@@ -61,22 +61,22 @@ func flattenSubsets(subsets []api.EndpointSubset) []string {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
glog.Info("Kubernetes Elasticsearch logging discovery")
|
||||
klog.Info("Kubernetes Elasticsearch logging discovery")
|
||||
|
||||
cc, err := buildConfigFromEnvs(os.Getenv("APISERVER_HOST"), os.Getenv("KUBE_CONFIG_FILE"))
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to make client: %v", err)
|
||||
klog.Fatalf("Failed to make client: %v", err)
|
||||
}
|
||||
client, err := clientset.NewForConfig(cc)
|
||||
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to make client: %v", err)
|
||||
klog.Fatalf("Failed to make client: %v", err)
|
||||
}
|
||||
namespace := metav1.NamespaceSystem
|
||||
envNamespace := os.Getenv("NAMESPACE")
|
||||
if envNamespace != "" {
|
||||
if _, err := client.Core().Namespaces().Get(envNamespace, metav1.GetOptions{}); err != nil {
|
||||
glog.Fatalf("%s namespace doesn't exist: %v", envNamespace, err)
|
||||
klog.Fatalf("%s namespace doesn't exist: %v", envNamespace, err)
|
||||
}
|
||||
namespace = envNamespace
|
||||
}
|
||||
@@ -98,7 +98,7 @@ func main() {
|
||||
// If we did not find an elasticsearch logging service then log a warning
|
||||
// and return without adding any unicast hosts.
|
||||
if elasticsearch == nil {
|
||||
glog.Warningf("Failed to find the elasticsearch-logging service: %v", err)
|
||||
klog.Warningf("Failed to find the elasticsearch-logging service: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -112,17 +112,17 @@ func main() {
|
||||
continue
|
||||
}
|
||||
addrs = flattenSubsets(endpoints.Subsets)
|
||||
glog.Infof("Found %s", addrs)
|
||||
klog.Infof("Found %s", addrs)
|
||||
if len(addrs) > 0 && len(addrs) >= count {
|
||||
break
|
||||
}
|
||||
}
|
||||
// If there was an error finding endpoints then log a warning and quit.
|
||||
if err != nil {
|
||||
glog.Warningf("Error finding endpoints: %v", err)
|
||||
klog.Warningf("Error finding endpoints: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
glog.Infof("Endpoints = %s", addrs)
|
||||
klog.Infof("Endpoints = %s", addrs)
|
||||
fmt.Printf("discovery.zen.ping.unicast.hosts: [%s]\n", strings.Join(addrs, ", "))
|
||||
}
|
||||
|
Reference in New Issue
Block a user