diff --git a/discovery/cached/memory/memcache.go b/discovery/cached/memory/memcache.go index 6e01066b..9de389fa 100644 --- a/discovery/cached/memory/memcache.go +++ b/discovery/cached/memory/memcache.go @@ -19,8 +19,6 @@ package memory import ( "errors" "fmt" - "net" - "net/url" "sync" "syscall" @@ -64,19 +62,11 @@ var _ discovery.CachedDiscoveryInterface = &memCacheClient{} // "Connection reset" error which usually means that apiserver is temporarily // unavailable. func isTransientConnectionError(err error) bool { - urlError, ok := err.(*url.Error) - if !ok { - return false + var errno syscall.Errno + if errors.As(err, &errno) { + return errno == syscall.ECONNREFUSED || errno == syscall.ECONNRESET } - opError, ok := urlError.Err.(*net.OpError) - if !ok { - return false - } - errno, ok := opError.Err.(syscall.Errno) - if !ok { - return false - } - return errno == syscall.ECONNREFUSED || errno == syscall.ECONNRESET + return false } func isTransientError(err error) bool {