Fresh dep ensure

This commit is contained in:
Mike Cronce
2018-11-26 13:23:56 -05:00
parent 93cb8a04d7
commit 407478ab9a
9016 changed files with 551394 additions and 279685 deletions

9
vendor/k8s.io/kubernetes/pkg/probe/OWNERS generated vendored Normal file
View File

@ -0,0 +1,9 @@
approvers:
- Random-Liu
- dchen1107
- derekwaynecarr
- tallclair
- vishh
- yujuhong
reviewers:
- sig-node-reviewers

View File

@ -12,7 +12,7 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/probe/exec",
deps = [
"//pkg/probe:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
"//vendor/k8s.io/utils/exec:go_default_library",
],
)

View File

@ -20,30 +20,34 @@ import (
"k8s.io/kubernetes/pkg/probe"
"k8s.io/utils/exec"
"github.com/golang/glog"
"k8s.io/klog"
)
func New() ExecProber {
// New creates a Prober.
func New() Prober {
return execProber{}
}
type ExecProber interface {
// Prober is an interface defining the Probe object for container readiness/liveness checks.
type Prober interface {
Probe(e exec.Cmd) (probe.Result, string, error)
}
type execProber struct{}
// Probe executes a command to check the liveness/readiness of container
// from executing a command. Returns the Result status, command output, and
// errors if any.
func (pr execProber) Probe(e exec.Cmd) (probe.Result, string, error) {
data, err := e.CombinedOutput()
glog.V(4).Infof("Exec probe response: %q", string(data))
klog.V(4).Infof("Exec probe response: %q", string(data))
if err != nil {
exit, ok := err.(exec.ExitError)
if ok {
if exit.ExitStatus() == 0 {
return probe.Success, string(data), nil
} else {
return probe.Failure, string(data), nil
}
return probe.Failure, string(data), nil
}
return probe.Unknown, "", err
}

View File

@ -13,8 +13,8 @@ go_library(
deps = [
"//pkg/probe:go_default_library",
"//pkg/version:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@ -28,21 +28,23 @@ import (
"k8s.io/kubernetes/pkg/probe"
"k8s.io/kubernetes/pkg/version"
"github.com/golang/glog"
"k8s.io/klog"
)
func New() HTTPProber {
// New creates Prober that will skip TLS verification while probing.
func New() Prober {
tlsConfig := &tls.Config{InsecureSkipVerify: true}
return NewWithTLSConfig(tlsConfig)
}
// NewWithTLSConfig takes tls config as parameter.
func NewWithTLSConfig(config *tls.Config) HTTPProber {
func NewWithTLSConfig(config *tls.Config) Prober {
transport := utilnet.SetTransportDefaults(&http.Transport{TLSClientConfig: config, DisableKeepAlives: true})
return httpProber{transport}
}
type HTTPProber interface {
// Prober is an interface that defines the Probe function for doing HTTP readiness/liveness checks.
type Prober interface {
Probe(url *url.URL, headers http.Header, timeout time.Duration) (probe.Result, string, error)
}
@ -50,12 +52,13 @@ type httpProber struct {
transport *http.Transport
}
// Probe returns a ProbeRunner capable of running an http check.
// Probe returns a ProbeRunner capable of running an HTTP check.
func (pr httpProber) Probe(url *url.URL, headers http.Header, timeout time.Duration) (probe.Result, string, error) {
return DoHTTPProbe(url, headers, &http.Client{Timeout: timeout, Transport: pr.transport})
}
type HTTPGetInterface interface {
// GetHTTPInterface is an interface for making HTTP requests, that returns a response and error.
type GetHTTPInterface interface {
Do(req *http.Request) (*http.Response, error)
}
@ -63,7 +66,7 @@ type HTTPGetInterface interface {
// If the HTTP response code is successful (i.e. 400 > code >= 200), it returns Success.
// If the HTTP response code is unsuccessful or HTTP communication fails, it returns Failure.
// This is exported because some other packages may want to do direct HTTP probes.
func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (probe.Result, string, error) {
func DoHTTPProbe(url *url.URL, headers http.Header, client GetHTTPInterface) (probe.Result, string, error) {
req, err := http.NewRequest("GET", url.String(), nil)
if err != nil {
// Convert errors into failures to catch timeouts.
@ -93,9 +96,9 @@ func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (pr
}
body := string(b)
if res.StatusCode >= http.StatusOK && res.StatusCode < http.StatusBadRequest {
glog.V(4).Infof("Probe succeeded for %s, Response: %v", url.String(), *res)
klog.V(4).Infof("Probe succeeded for %s, Response: %v", url.String(), *res)
return probe.Success, body, nil
}
glog.V(4).Infof("Probe failed for %s with request headers %v, response body: %v", url.String(), headers, body)
klog.V(4).Infof("Probe failed for %s with request headers %v, response body: %v", url.String(), headers, body)
return probe.Failure, fmt.Sprintf("HTTP probe failed with statuscode: %d", res.StatusCode), nil
}

View File

@ -57,7 +57,7 @@ func TestHTTPProbeChecker(t *testing.T) {
if r.URL.Path == "/" {
http.Redirect(w, r, "/new", s)
} else if bad && r.URL.Path == "/new" {
w.WriteHeader(http.StatusInternalServerError)
http.Error(w, "", http.StatusInternalServerError)
}
}
}

View File

@ -16,10 +16,14 @@ limitations under the License.
package probe
// Result is a string used to handle the results for probing container readiness/livenss
type Result string
const (
// Success Result
Success Result = "success"
// Failure Result
Failure Result = "failure"
// Unknown Result
Unknown Result = "unknown"
)

View File

@ -12,7 +12,7 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/probe/tcp",
deps = [
"//pkg/probe:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@ -23,19 +23,22 @@ import (
"k8s.io/kubernetes/pkg/probe"
"github.com/golang/glog"
"k8s.io/klog"
)
func New() TCPProber {
// New creates Prober.
func New() Prober {
return tcpProber{}
}
type TCPProber interface {
// Prober is an interface that defines the Probe function for doing TCP readiness/liveness checks.
type Prober interface {
Probe(host string, port int, timeout time.Duration) (probe.Result, string, error)
}
type tcpProber struct{}
// Probe returns a ProbeRunner capable of running an TCP check.
func (pr tcpProber) Probe(host string, port int, timeout time.Duration) (probe.Result, string, error) {
return DoTCPProbe(net.JoinHostPort(host, strconv.Itoa(port)), timeout)
}
@ -52,7 +55,7 @@ func DoTCPProbe(addr string, timeout time.Duration) (probe.Result, string, error
}
err = conn.Close()
if err != nil {
glog.Errorf("Unexpected error closing TCP probe socket: %v (%#v)", err, err)
klog.Errorf("Unexpected error closing TCP probe socket: %v (%#v)", err, err)
}
return probe.Success, "", nil
}