Commit Graph

35 Commits

Author SHA1 Message Date
Jason Simmons
5a6acf85fa Align lifecycle handlers and probes
Align the behavior of HTTP-based lifecycle handlers and HTTP-based
probers, converging on the probers implementation. This fixes multiple
deficiencies in the current implementation of lifecycle handlers
surrounding what functionality is available.

The functionality is gated by the features.ConsistentHTTPGetHandlers feature gate.
2022-10-19 09:51:52 -07:00
Paco Xu
3c06ef9c0c probe: add test case for redirect terminating cases 2021-12-16 13:04:56 +08:00
刁浩 10284789
d8e91ab727 Fix test order in /pkg/probe/http/http_test.go 2021-06-05 07:27:34 +00:00
Hugo Fonseca
ba514718da HTTP Prove: Removes Accept-Encoding header from http probe
The Accept-Encoding header is added by default because compression is enabled by default. By removing it we are reducing the sent payload.
2020-11-09 22:20:56 +00:00
Hugo Fonseca
0794bf65bc HTTP Probe: Add 'Accept' header by default
When using a HTTP probe, the request will now have a "Accept" header by default with the "*/*" (accept all)
Most tools do add this header (see curl) so it's a reasonable expectation that http probe has it as well
2020-10-30 00:32:49 +00:00
Jordan Liggitt
fdf9cab843 Deflake TestHTTPProbeProxy 2020-09-04 11:22:11 -04:00
SataQiu
68ba2fecc1 fix staticcheck failures of pkg/probe/http 2020-04-10 12:14:25 +08:00
Ryan Phillips
1065add75e fix kubelet status http calls with truncation
PR#76518 introduced a change to limit the the read on various calls with
utilio.ReadAtMost.  By design, ReadAtMost will return an error if there
is a truncation, but the calling code needs to know to handle it.
2019-09-12 19:55:27 -05:00
mattjmcnaughton
46267759bc
Code cleanup for for probe/http
Two small code cleanup changes for `probe/http`.

- Tests name the `followNonLocalRedirects` variable before passing to
`New`, so its clear what the boolean flag in the construct impacts.
- Change import name from `httprobe` to `httpprobe` when used by
`pkg/kubelet/prober/prober.go`. Establishes consistency with other uses
in the repo.
2019-06-15 12:09:00 -04:00
Abdullah Gharaibeh
ef2e5bb8ed Addressed reviewers comments. 2019-05-17 10:48:43 -04:00
Abdullah Gharaibeh
71b1565f2e Fixed the unit test and added a failure case. 2019-05-16 18:21:51 -04:00
Abdullah Gharaibeh
792ab9d3d0 Added a unit test to verify that host header is preserved after probe redirect. 2019-05-16 10:37:56 -04:00
Tim Allclair
e6ea4f0538 Don't follow non-local redirects for http probes 2019-03-15 11:04:30 -07:00
WanLinghao
29f7e537a9 When node got proxy settings like "http_proxy=xxx".
The http probe would use that settings. This could cause probe failure.
This patch fix it.
2018-11-29 16:35:56 +08:00
Ibrahim AshShohail
2fb3ba71f1
Update usages of http.ResponseWriter.WriteHeader to use http.Error
Signed-off-by: Ibrahim AshShohail <me@ibrasho.com>
2018-10-14 05:58:00 +03:00
Yongkun Anfernee Gui
cb6df34bef Test probe for redirect endpoint
Make sure #18233 works
2017-12-13 14:15:24 -08:00
Paul Tyng
a990e60193 Set default User-Agent on http probe
If unspecified in probe definition, User-Agent will be set to
`kube-probe/<version major.minor>` on httpGet probe types
instead of the default Go User-Agent.
2017-06-21 10:50:33 -04:00
Eric Chiang
a1b310e004 pkg/probe/http: don't compare error strings in tests
TestHTTPProbeChecker fails on the Go1.7 release candidates. The
package's history show that this was the case for Go1.5 and Go1.6
as well.

The test depend on errors holding specific string values, behavior
not guarenteed in the standard library API, and causing new test
failures every minor Go release. Just look for an error rather than
trying to inspect it using string comparison. If we feel this
impacts coverage we can add more test cases.
2016-07-19 11:13:36 -07:00
David McMahon
ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
zhouhaibing089
5923fd352e followup to add http server close method 2016-05-05 12:04:41 +08:00
Ed Robinson
55b1ae857c Allow setting the Host header in a httpGet probe
Fixes #24288
2016-04-15 01:59:42 +01:00
Joe Finney
bc791cbd4e Fix pkg/probe/http unit test for go 1.6. 2016-03-21 15:27:02 -07:00
Rudi Chiarito
a2d1bb7acf Add httpHeaders to httpGet liveness probe
Also update existing documentation and try to steer users away from 'host'.
Add validation.
2016-02-05 11:20:04 -05:00
David Oppenheimer
8ac484793d Comment out calls to httptest.Server.Close() to work around
https://github.com/golang/go/issues/12262 . See #19254 for
more details. This change should be reverted when we upgrade
to Go 1.6.
2016-01-11 23:02:11 -08:00
jiangyaoguo
cbbb3f7af0 return response StatusCode when http probe fail 2015-11-24 13:59:44 +08:00
Daniel Martí
0b10c6cfae Fix failing test in probe/http
The error that Go 1.5 returns is different compared to 1.4. Support both.
2015-09-10 11:44:13 -07:00
Mike Danese
8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
Steve Kuznetsov
3008ff6150 Changed HTTPGetAction to allow user-defined schemes 2015-06-25 16:59:12 -04:00
Tim Hockin
75617e8760 Better kubelet logging for probes
Log when we actually run probes and event when they fail.  Print the output of
a probe, too.
2015-05-20 08:56:45 -07:00
Eric Paris
6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Mike Danese
14bfec92f2 rename probe.Status to probe.Result. 2015-02-05 15:49:58 -08:00
George Kuan
e8c33b7916 Add timeouts to HealthChecks and retry checks
Fixes issue #3532. Added timeouts for HTTP and TCP checks
and enabled kubelet/probe to kubelet#maxRetries times
before declaring Failure.

Added Probe.TimeoutSecs to API

Probe variants now check container.LivenessProbe.TimeoutSeconds
Also added a test for timeouts in http_test.go.
2015-02-05 06:04:45 -08:00
Mike Danese
5dc6362f8a rename probe.Healthy to probe.Success and renam probe.Unhealthy to probe.Failure. 2015-01-27 11:20:30 -08:00
Mike Danese
6eb0b89cbd add Probers to Probe pkgs. 2015-01-27 11:20:30 -08:00
Mike Danese
5ee4071cf1 migrated tests 2015-01-27 11:20:29 -08:00