diff --git a/cmd/auto-pause/auto-pause-hook/config.go b/cmd/auto-pause/auto-pause-hook/config.go index d149553c6dd5..0f25e3f041c7 100644 --- a/cmd/auto-pause/auto-pause-hook/config.go +++ b/cmd/auto-pause/auto-pause-hook/config.go @@ -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 ( @@ -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 } @@ -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) } @@ -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}, @@ -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 @@ -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") } diff --git a/cmd/auto-pause/auto-pause-hook/main.go b/cmd/auto-pause/auto-pause-hook/main.go index 29270f497e8f..96f40216f733 100644 --- a/cmd/auto-pause/auto-pause-hook/main.go +++ b/cmd/auto-pause/auto-pause-hook/main.go @@ -25,7 +25,6 @@ import ( "net/http" "strconv" - "github.com/golang/glog" "github.com/mattbaird/jsonpatch" v1 "k8s.io/api/admission/v1" @@ -33,6 +32,7 @@ import ( 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" ) @@ -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) } } diff --git a/go.mod b/go.mod index 4eef72b74ee4..be50f7cbef7e 100644 --- a/go.mod +++ b/go.mod @@ -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