Documentation
¶
Overview ¶
Package hooks is the Go port of .lok8s/libs/hooks — dev-time lifecycle actions on rendered artifacts, selected by label.
INTERNAL: driven by the Tilt `hooks:` wrapper (a local_resource cmd), not a user workflow. Acts on the live cluster + the domain's rendered artifacts to re-run/refresh a LABELLED subset when a watched file changes:
recreate — delete + apply the matched objects (immutable Jobs re-run) restart — rollout restart the matched workloads apply — re-apply the matched objects (no delete)
Targeting is by LABEL — the same labels lok8s applies — passed kubectl-style: lo hooks recreate --selector lok8s.dev/type=seed,… The selector validation and the label filter are native (the bash built a yq `select(...)` expression; the ACCEPTED grammar and error strings are identical); kubectl and the tilt probes run through the Runner seam.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrHandled = ui.ErrHandled // one sentinel for every package; see internal/ui
ErrHandled marks a failure whose message was already printed in the bash [error] format; callers exit non-zero without printing anything further.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Paths *config.Paths
Runner execx.Runner
Out io.Writer
ErrOut io.Writer
// Domain is the parent's resolved global arg (bash: consumed via
// :^~domain), so the Tilt wrapper never has to pass it.
Domain string
// Tilt answers the session probes (Running/HasResource/
// TriggerResource). nil → a Context over the same Runner.
Tilt *tilt.Context
// Applier runs the kapply::apply port. nil → kapply.NewApplier.
Applier *kapply.Applier
}
Context carries one hooks-command invocation. LOK8S_NONINTERACTIVE=1 is exported by the command layer before anything runs (bash: main::hooks) — Tilt's local_resource has no controlling terminal, so kapply must never try the /dev/tty progress UI or confirm prompts.