Custom resource definition
Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
parent
cfaf47c8a2
commit
4c060a78cc
1348 changed files with 92364 additions and 55766 deletions
12
vendor/k8s.io/apimachinery/pkg/util/net/http.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/util/net/http.go
generated
vendored
|
@ -19,6 +19,7 @@ package net
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -61,6 +62,9 @@ func JoinPreservingTrailingSlash(elem ...string) string {
|
|||
// differentiate probable errors in connection behavior between normal "this is
|
||||
// disconnected" should use the method.
|
||||
func IsProbableEOF(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if uerr, ok := err.(*url.Error); ok {
|
||||
err = uerr.Err
|
||||
}
|
||||
|
@ -87,8 +91,8 @@ func SetOldTransportDefaults(t *http.Transport) *http.Transport {
|
|||
// ProxierWithNoProxyCIDR allows CIDR rules in NO_PROXY
|
||||
t.Proxy = NewProxierWithNoProxyCIDR(http.ProxyFromEnvironment)
|
||||
}
|
||||
if t.Dial == nil {
|
||||
t.Dial = defaultTransport.Dial
|
||||
if t.DialContext == nil {
|
||||
t.DialContext = defaultTransport.DialContext
|
||||
}
|
||||
if t.TLSHandshakeTimeout == 0 {
|
||||
t.TLSHandshakeTimeout = defaultTransport.TLSHandshakeTimeout
|
||||
|
@ -116,7 +120,7 @@ type RoundTripperWrapper interface {
|
|||
WrappedRoundTripper() http.RoundTripper
|
||||
}
|
||||
|
||||
type DialFunc func(net, addr string) (net.Conn, error)
|
||||
type DialFunc func(ctx context.Context, net, addr string) (net.Conn, error)
|
||||
|
||||
func DialerFor(transport http.RoundTripper) (DialFunc, error) {
|
||||
if transport == nil {
|
||||
|
@ -125,7 +129,7 @@ func DialerFor(transport http.RoundTripper) (DialFunc, error) {
|
|||
|
||||
switch transport := transport.(type) {
|
||||
case *http.Transport:
|
||||
return transport.Dial, nil
|
||||
return transport.DialContext, nil
|
||||
case RoundTripperWrapper:
|
||||
return DialerFor(transport.WrappedRoundTripper())
|
||||
default:
|
||||
|
|
66
vendor/k8s.io/apimachinery/pkg/util/net/port_range.go
generated
vendored
66
vendor/k8s.io/apimachinery/pkg/util/net/port_range.go
generated
vendored
|
@ -43,14 +43,19 @@ func (pr PortRange) String() string {
|
|||
return fmt.Sprintf("%d-%d", pr.Base, pr.Base+pr.Size-1)
|
||||
}
|
||||
|
||||
// Set parses a string of the form "min-max", inclusive at both ends, and
|
||||
// Set parses a string of the form "value", "min-max", or "min+offset", inclusive at both ends, and
|
||||
// sets the PortRange from it. This is part of the flag.Value and pflag.Value
|
||||
// interfaces.
|
||||
func (pr *PortRange) Set(value string) error {
|
||||
value = strings.TrimSpace(value)
|
||||
const (
|
||||
SinglePortNotation = 1 << iota
|
||||
HyphenNotation
|
||||
PlusNotation
|
||||
)
|
||||
|
||||
// TODO: Accept "80" syntax
|
||||
// TODO: Accept "80+8" syntax
|
||||
value = strings.TrimSpace(value)
|
||||
hyphenIndex := strings.Index(value, "-")
|
||||
plusIndex := strings.Index(value, "+")
|
||||
|
||||
if value == "" {
|
||||
pr.Base = 0
|
||||
|
@ -58,20 +63,51 @@ func (pr *PortRange) Set(value string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
hyphenIndex := strings.Index(value, "-")
|
||||
if hyphenIndex == -1 {
|
||||
return fmt.Errorf("expected hyphen in port range")
|
||||
var err error
|
||||
var low, high int
|
||||
var notation int
|
||||
|
||||
if plusIndex == -1 && hyphenIndex == -1 {
|
||||
notation |= SinglePortNotation
|
||||
}
|
||||
if hyphenIndex != -1 {
|
||||
notation |= HyphenNotation
|
||||
}
|
||||
if plusIndex != -1 {
|
||||
notation |= PlusNotation
|
||||
}
|
||||
|
||||
var err error
|
||||
var low int
|
||||
var high int
|
||||
low, err = strconv.Atoi(value[:hyphenIndex])
|
||||
if err == nil {
|
||||
switch notation {
|
||||
case SinglePortNotation:
|
||||
var port int
|
||||
port, err = strconv.Atoi(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
low = port
|
||||
high = port
|
||||
case HyphenNotation:
|
||||
low, err = strconv.Atoi(value[:hyphenIndex])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
high, err = strconv.Atoi(value[hyphenIndex+1:])
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to parse port range: %s: %v", value, err)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case PlusNotation:
|
||||
var offset int
|
||||
low, err = strconv.Atoi(value[:plusIndex])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
offset, err = strconv.Atoi(value[plusIndex+1:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
high = low + offset
|
||||
default:
|
||||
return fmt.Errorf("unable to parse port range: %s", value)
|
||||
}
|
||||
|
||||
if low > 65535 || high > 65535 {
|
||||
|
|
14
vendor/k8s.io/apimachinery/pkg/util/net/util.go
generated
vendored
14
vendor/k8s.io/apimachinery/pkg/util/net/util.go
generated
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue