mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-04-12 00:00:26 +08:00
Merge pull request #62028 from nikhita/automated-cherry-pick-of-#57243-upstream-release-1.9
Automatic merge from submit-queue. Automated cherry pick of #57243: Register metav1 types into samplecontroller api scheme Fixes kubernetes/sample-controller#14 Cherry pick of #57243 on release-1.9. #57243: Register metav1 types into samplecontroller api scheme ```release-note Fix error message regarding conversion of `v1.ListOptions` to `samplecontroller.k8s.io/v1alpha1`. ``` Kubernetes-commit: 53daf2849cdd6c31a7f801c987e8386bb2fd404d
This commit is contained in:
+12
-2
@@ -18,6 +18,8 @@ package net
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
"syscall"
|
||||
)
|
||||
@@ -38,8 +40,16 @@ func IPNetEqual(ipnet1, ipnet2 *net.IPNet) bool {
|
||||
|
||||
// Returns if the given err is "connection reset by peer" error.
|
||||
func IsConnectionReset(err error) bool {
|
||||
opErr, ok := err.(*net.OpError)
|
||||
if ok && opErr.Err.Error() == syscall.ECONNRESET.Error() {
|
||||
if urlErr, ok := err.(*url.Error); ok {
|
||||
err = urlErr.Err
|
||||
}
|
||||
if opErr, ok := err.(*net.OpError); ok {
|
||||
err = opErr.Err
|
||||
}
|
||||
if osErr, ok := err.(*os.SyscallError); ok {
|
||||
err = osErr.Err
|
||||
}
|
||||
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ECONNRESET {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user