mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
add probe warning event body like 'Probe terminated redirects'
This commit is contained in:
parent
93d858c46e
commit
65529fe6e9
@ -129,6 +129,10 @@ func DoHTTPProbe(url *url.URL, headers http.Header, client GetHTTPInterface) (pr
|
|||||||
if res.StatusCode >= http.StatusOK && res.StatusCode < http.StatusBadRequest {
|
if res.StatusCode >= http.StatusOK && res.StatusCode < http.StatusBadRequest {
|
||||||
if res.StatusCode >= http.StatusMultipleChoices { // Redirect
|
if res.StatusCode >= http.StatusMultipleChoices { // Redirect
|
||||||
klog.V(4).Infof("Probe terminated redirects for %s, Response: %v", url.String(), *res)
|
klog.V(4).Infof("Probe terminated redirects for %s, Response: %v", url.String(), *res)
|
||||||
|
// add some message in case body is empty when redirect is terminated
|
||||||
|
if len(body) == 0 {
|
||||||
|
return probe.Warning, "Probe terminated redirects", nil
|
||||||
|
}
|
||||||
return probe.Warning, body, nil
|
return probe.Warning, body, nil
|
||||||
}
|
}
|
||||||
klog.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)
|
||||||
|
@ -310,7 +310,7 @@ var _ = SIGDescribe("Probing container", func() {
|
|||||||
"reason": events.ContainerProbeWarning,
|
"reason": events.ContainerProbeWarning,
|
||||||
}.AsSelector().String()
|
}.AsSelector().String()
|
||||||
framework.ExpectNoError(e2eevents.WaitTimeoutForEvent(
|
framework.ExpectNoError(e2eevents.WaitTimeoutForEvent(
|
||||||
f.ClientSet, f.Namespace.Name, expectedEvent, "0.0.0.0", framework.PodEventTimeout))
|
f.ClientSet, f.Namespace.Name, expectedEvent, "Probe terminated redirects, Response body: <a href=\"http://0.0.0.0/\">Found</a>.", framework.PodEventTimeout))
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user