Don't adopt complex http probes for health checks
This commit is contained in:
parent
58d5638888
commit
cb05e7b18e
1 changed files with 10 additions and 1 deletions
|
@ -384,7 +384,7 @@ func (t *GCETranslator) getHTTPProbe(l map[string]string, targetPort intstr.IntO
|
|||
for _, pod := range pl {
|
||||
logStr := fmt.Sprintf("Pod %v matching service selectors %v (targetport %+v)", pod.Name, l, targetPort)
|
||||
for _, c := range pod.Spec.Containers {
|
||||
if c.ReadinessProbe == nil || c.ReadinessProbe.Handler.HTTPGet == nil {
|
||||
if !isSimpleHTTPProbe(c.ReadinessProbe) {
|
||||
continue
|
||||
}
|
||||
for _, p := range c.Ports {
|
||||
|
@ -403,6 +403,15 @@ func (t *GCETranslator) getHTTPProbe(l map[string]string, targetPort intstr.IntO
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
// isSimpleHTTPProbe returns true if the given Probe is:
|
||||
// - an HTTPGet probe, as opposed to a tcp or exec probe
|
||||
// - has a scheme of HTTP, as opposed to HTTPS
|
||||
// - has no special host or headers fields
|
||||
func isSimpleHTTPProbe(probe *api.Probe) bool {
|
||||
return (probe != nil && probe.Handler.HTTPGet != nil && probe.Handler.HTTPGet.Host == "" &&
|
||||
probe.Handler.HTTPGet.Scheme == api.URISchemeHTTP && len(probe.Handler.HTTPGet.HTTPHeaders) == 0)
|
||||
}
|
||||
|
||||
// HealthCheck returns the http readiness probe for the endpoint backing the
|
||||
// given nodePort. If no probe is found it returns a health check with "" as
|
||||
// the request path, callers are responsible for swapping this out for the
|
||||
|
|
Loading…
Reference in a new issue