kubernetesk8s.io/kubernetes/pkg/probe/http Index | Files

package http

import "k8s.io/kubernetes/pkg/probe/http"

Index

Functions

func DoHTTPProbe

func DoHTTPProbe(req *http.Request, client GetHTTPInterface) (probe.Result, string, error)

DoHTTPProbe checks if a GET request to the url succeeds. 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 NewProbeRequest

func NewProbeRequest(url *url.URL, headers http.Header) (*http.Request, error)

NewProbeRequest returns an http.Request suitable for use as a request for a probe.

func NewRequestForHTTPGetAction

func NewRequestForHTTPGetAction(httpGet *v1.HTTPGetAction, container *v1.Container, podIP string, userAgentFragment string) (*http.Request, error)

NewRequestForHTTPGetAction returns an http.Request derived from httpGet. When httpGet.Host is empty, podIP will be used instead.

func RedirectChecker

func RedirectChecker(followNonLocalRedirects bool) func(*http.Request, []*http.Request) error

RedirectChecker returns a function that can be used to check HTTP redirects.

Types

type GetHTTPInterface

type GetHTTPInterface interface {
	Do(req *http.Request) (*http.Response, error)
}

GetHTTPInterface is an interface for making HTTP requests, that returns a response and error.

type Prober

type Prober interface {
	Probe(req *http.Request, timeout time.Duration) (probe.Result, string, error)
}

Prober is an interface that defines the Probe function for doing HTTP readiness/liveness checks.

func New

func New(followNonLocalRedirects bool) Prober

New creates Prober that will skip TLS verification while probing. followNonLocalRedirects configures whether the prober should follow redirects to a different hostname. If disabled, redirects to other hosts will trigger a warning result.

func NewWithTLSConfig

func NewWithTLSConfig(config *tls.Config, followNonLocalRedirects bool) Prober

NewWithTLSConfig takes tls config as parameter. followNonLocalRedirects configures whether the prober should follow redirects to a different hostname. If disabled, redirects to other hosts will trigger a warning result.

Source Files

http.go request.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
3 hours ago

Tools for package owners.