probe

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package probe implements HTTP readiness checking: the controller calls out to a container over HTTP, rather than the container self-reporting health via Docker's own HEALTHCHECK state machine. The app spec's health.readiness/liveness config is modeled on Kubernetes' prober pattern for exactly this reason, the same choice ADR 002's Consequences section already commits to over Coolify's confirmed weaker default (health checking disabled unless the user opts in, gated entirely on Docker's own HEALTHCHECK).

Two shapes, one mechanism: WaitReady polls until a freshly started container becomes ready, gating a deploy's cutover. Check runs a single attempt, for the application controller's level-triggered liveness check, where the reconcile loop itself is the loop and this package must not add a second one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, client *http.Client, addr string, cfg Config) error

Check runs exactly one probe attempt against http://addr+cfg.Path, bounded by cfg.Timeout, and returns nil only for a 2xx response. cfg.Interval is ignored: a caller wanting repetition owns the repetition.

func WaitReady

func WaitReady(ctx context.Context, client *http.Client, addr string, cfg Config) error

WaitReady polls http://addr+cfg.Path on cfg.Interval, each attempt bounded by cfg.Timeout, until a response in the 2xx range comes back or ctx is done. It returns nil on the first success, or ctx's error (wrapped with the last probe failure reason, if any) once ctx expires.

client is caller-supplied rather than using http.DefaultClient, so callers (and tests) control transport settings and can inject a client pointed at a test server.

Types

type Config

type Config struct {
	Path     string
	Interval time.Duration
	Timeout  time.Duration
}

Config is one HTTP probe's settings. Zero Interval or Timeout means "not specified" (matching internal/spec's optional YAML fields); WaitReady applies sensible defaults rather than busy-looping on a zero-length interval or never timing out a single attempt.

Jump to

Keyboard shortcuts

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