Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace glog with klog #10955

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions cmd/auto-pause/auto-pause-hook/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"

"github.com/golang/glog"
"k8s.io/klog/v2"
)

var (
Expand All @@ -41,11 +40,11 @@ var (
func client() *kubernetes.Clientset {
config, err := rest.InClusterConfig()
if err != nil {
glog.Fatal(err)
klog.Fatal(err)
}
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
glog.Fatal(err)
klog.Fatal(err)
}
return clientset
}
Expand All @@ -55,14 +54,14 @@ func client() *kubernetes.Clientset {
func apiServerCert(clientset *kubernetes.Clientset) []byte {
c, err := clientset.CoreV1().ConfigMaps("kube-system").Get(context.TODO(), "extension-apiserver-authentication", metav1.GetOptions{})
if err != nil {
glog.Fatal(err)
klog.Fatal(err)
}

pem, ok := c.Data["requestheader-client-ca-file"]
if !ok {
glog.Fatalf(fmt.Sprintf("cannot find the ca.crt in the configmap, configMap.Data is %#v", c.Data))
klog.Fatalf(fmt.Sprintf("cannot find the ca.crt in the configmap, configMap.Data is %#v", c.Data))
}
glog.Info("client-ca-file=", pem)
klog.Info("client-ca-file=", pem)
return []byte(pem)
}

Expand All @@ -73,7 +72,7 @@ func configTLS(clientset *kubernetes.Clientset, serverCert []byte, serverKey []b

sCert, err := tls.X509KeyPair(serverCert, serverKey)
if err != nil {
glog.Fatal(err)
klog.Fatal(err)
}
return &tls.Config{
Certificates: []tls.Certificate{sCert},
Expand All @@ -89,7 +88,7 @@ func selfRegistration(clientset *kubernetes.Clientset, caCert []byte) {
_, err := client.Get(context.TODO(), webhookName, metav1.GetOptions{})
if err == nil {
if err2 := client.Delete(context.TODO(), webhookName, metav1.DeleteOptions{}); err2 != nil {
glog.Fatal(err2)
klog.Fatal(err2)
}
}
var failurePolicy v1.FailurePolicyType = v1.Fail
Expand Down Expand Up @@ -142,7 +141,7 @@ func selfRegistration(clientset *kubernetes.Clientset, caCert []byte) {
},
}
if _, err := client.Create(context.TODO(), webhookConfig, metav1.CreateOptions{}); err != nil {
glog.Fatalf("Client creation failed with %s", err)
klog.Fatalf("Client creation failed with %s", err)
}
log.Println("CLIENT CREATED")
}
4 changes: 2 additions & 2 deletions cmd/auto-pause/auto-pause-hook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import (
"net/http"
"strconv"

"github.com/golang/glog"
"github.com/mattbaird/jsonpatch"

v1 "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/constants"
)

Expand Down Expand Up @@ -171,6 +171,6 @@ func main() {
go selfRegistration(clientset, cacert)
err := server.ListenAndServeTLS("", "")
if err != nil {
glog.Fatalf("Start https server failed with %s", err)
klog.Fatalf("Start https server failed with %s", err)
}
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ require (
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/google/go-cmp v0.5.5
github.com/google/go-containerregistry v0.4.1
github.com/google/go-github v17.0.0+incompatible
Expand Down