Documentation ¶
Index ¶
Constants ¶
const ( PROBE_TIMEOUT = 3 * time.Second ProbeDelayVariance = 0.5 )
Variables ¶
var ( ExpectedResponses = []int{200, 201} ProbeDelay = float64(time.Second.Milliseconds()) )
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(headers v1alpha1.AdditionalHeaders) *Probe
func (*Probe) ExecuteProbe ¶
func (w *Probe) ExecuteProbe(ctx context.Context, probe *v1alpha1.DNSHealthCheckProbe) <-chan ProbeResult
ExecuteProbe executes the health check request on a background routine at the correct interval. It returns a channel on which it will send each probe result
func (*Probe) Start ¶
func (w *Probe) Start(clientctx context.Context, k8sClient client.Client, probe *v1alpha1.DNSHealthCheckProbe) 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