mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-21 19:17:04 +00:00
replaced spew.Sprintf with a util pretty print function
Kubernetes-commit: f638e2849fbddeb201b8290586a4747af99086bf
This commit is contained in:
committed by
Kubernetes Publisher
parent
04ef61f72b
commit
db3650d98f
@@ -32,12 +32,12 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
|
"k8s.io/apimachinery/pkg/util/dump"
|
||||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||||
"k8s.io/client-go/pkg/apis/clientauthentication"
|
"k8s.io/client-go/pkg/apis/clientauthentication"
|
||||||
"k8s.io/client-go/pkg/apis/clientauthentication/install"
|
"k8s.io/client-go/pkg/apis/clientauthentication/install"
|
||||||
@@ -81,8 +81,6 @@ func newCache() *cache {
|
|||||||
return &cache{m: make(map[string]*Authenticator)}
|
return &cache{m: make(map[string]*Authenticator)}
|
||||||
}
|
}
|
||||||
|
|
||||||
var spewConfig = &spew.ConfigState{DisableMethods: true, Indent: " "}
|
|
||||||
|
|
||||||
func cacheKey(conf *api.ExecConfig, cluster *clientauthentication.Cluster) string {
|
func cacheKey(conf *api.ExecConfig, cluster *clientauthentication.Cluster) string {
|
||||||
key := struct {
|
key := struct {
|
||||||
conf *api.ExecConfig
|
conf *api.ExecConfig
|
||||||
@@ -91,7 +89,7 @@ func cacheKey(conf *api.ExecConfig, cluster *clientauthentication.Cluster) strin
|
|||||||
conf: conf,
|
conf: conf,
|
||||||
cluster: cluster,
|
cluster: cluster,
|
||||||
}
|
}
|
||||||
return spewConfig.Sprint(key)
|
return dump.Pretty(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
type cache struct {
|
type cache struct {
|
||||||
|
@@ -24,10 +24,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
|
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/util/dump"
|
||||||
"k8s.io/apimachinery/pkg/util/net"
|
"k8s.io/apimachinery/pkg/util/net"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
@@ -191,7 +190,7 @@ func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
|
|||||||
errObject := apierrors.FromObject(event.Object)
|
errObject := apierrors.FromObject(event.Object)
|
||||||
statusErr, ok := errObject.(*apierrors.StatusError)
|
statusErr, ok := errObject.(*apierrors.StatusError)
|
||||||
if !ok {
|
if !ok {
|
||||||
klog.Error(spew.Sprintf("Received an error which is not *metav1.Status but %#+v", event.Object))
|
klog.Error(fmt.Sprintf("Received an error which is not *metav1.Status but %s", dump.Pretty(event.Object)))
|
||||||
// Retry unknown errors
|
// Retry unknown errors
|
||||||
return false, 0
|
return false, 0
|
||||||
}
|
}
|
||||||
@@ -220,7 +219,7 @@ func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
|
|||||||
|
|
||||||
// Log here so we have a record of hitting the unexpected error
|
// Log here so we have a record of hitting the unexpected error
|
||||||
// and we can whitelist some error codes if we missed any that are expected.
|
// and we can whitelist some error codes if we missed any that are expected.
|
||||||
klog.V(5).Info(spew.Sprintf("Retrying after unexpected error: %#+v", event.Object))
|
klog.V(5).Info(fmt.Sprintf("Retrying after unexpected error: %s", dump.Pretty(event.Object)))
|
||||||
|
|
||||||
// Retry
|
// Retry
|
||||||
return false, statusDelay
|
return false, statusDelay
|
||||||
|
Reference in New Issue
Block a user