probes

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROBE_TIMEOUT = 3 * time.Second
)

Variables

View Source
var (
	ExpectedResponses = []int{200, 201}
)

Functions

func TransportWithDNSResponse

func TransportWithDNSResponse(overrides map[string]string, allowInsecureCertificates bool) http.RoundTripper

TransportWithDNSResponse creates a new transport which overrides hostnames.

Types

type Probe

type Probe struct {
	Transport RoundTripperFunc
	// contains filtered or unexported fields
}

func NewProbe

func NewProbe(probeConfig *v1alpha1.DNSHealthCheckProbe, headers v1alpha1.AdditionalHeaders) *Probe

func (*Probe) ExecuteProbe

func (w *Probe) ExecuteProbe(ctx context.Context, probe *v1alpha1.DNSHealthCheckProbe) <-chan struct{}

func (*Probe) Start

func (w *Probe) Start(clientctx context.Context, k8sClient client.Client) context.CancelFunc

Start a worker in a separate gouroutine. Returns a cancel func to kill the worker. If a worker is nil, no routines will start and cancel could be ignored (still returning it to prevent panic)

type ProbeManager

type ProbeManager struct {
	// contains filtered or unexported fields
}

func NewProbeManager

func NewProbeManager() *ProbeManager

func (*ProbeManager) EnsureProbeWorker

func (m *ProbeManager) EnsureProbeWorker(ctx context.Context, k8sClient client.Client, probeCR *v1alpha1.DNSHealthCheckProbe, headers v1alpha1.AdditionalHeaders)

EnsureProbeWorker ensures a new worker per generation of the probe. New generation of probe - new worker. If the generation has not changed, it will re-create a worker. If context is done (we are deleting) that worker will die immediately.

func (*ProbeManager) StopProbeWorker

func (m *ProbeManager) StopProbeWorker(ctx context.Context, probeCR *v1alpha1.DNSHealthCheckProbe)

StopProbeWorker stops the worker and removes it from the WorkerManager

type ProbeResult

type ProbeResult struct {
	CheckedAt metav1.Time
	Healthy   bool
	Reason    string
	Status    int
}

type RoundTripperFunc

type RoundTripperFunc func(*http.Request) (*http.Response, error)

func (RoundTripperFunc) RoundTrip

func (fn RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL