Documentation
¶
Overview ¶
Package poststarthooks executes post-start hook actions on sandbox pods that have just transitioned Starting → Running. It implements sandboxpool.SandboxReadyHook.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶ added in v0.0.5
type Action struct {
// Exec runs a shell command inside the sandbox container.
Exec *ExecAction `json:"exec,omitempty"`
// HTTPPost sends a POST request to an in-sandbox HTTP endpoint via the gateway.
HTTPPost *HTTPPostAction `json:"httpPost,omitempty"`
}
Action describes a single action to execute after a sandbox becomes Running. Exactly one of Exec or HTTPPost should be set (mirrors k8s ProbeHandler style). The action is serialized as JSON to the SandboxPostStartHooksAnnotationKey pod annotation at claim time, then consumed here when the pod reaches Running.
type ExecAction ¶ added in v0.0.5
type ExecAction struct {
// Command is passed to sh -c inside the first container.
Command string `json:"command"`
}
ExecAction runs a command inside the sandbox container.
type HTTPPostAction ¶ added in v0.0.5
type HTTPPostAction struct {
// Port is the target port of the in-sandbox service (required).
Port int32 `json:"port"`
// Path is the request path, e.g. "/init".
Path string `json:"path"`
// Body is an arbitrary JSON object serialized as the request body.
Body map[string]any `json:"body,omitempty"`
// Headers are extra HTTP headers to include (e.g. for authentication).
Headers map[string]string `json:"headers,omitempty"`
}
HTTPPostAction sends a POST to a port/path inside the sandbox, routed through the gateway.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner implements sandboxpool.SandboxReadyHook. It reads post-start hook actions from pod annotations and executes them after the sandbox transitions Starting → Running.
func NewRunner ¶
func NewRunner(gatewayBaseURL string, clientset kubernetes.Interface, restConfig *rest.Config) *Runner
NewRunner creates a Runner. gatewayBaseURL may be empty (HTTP hooks are skipped). clientset / restConfig may be nil (Exec hooks are skipped).
func (*Runner) OnSandboxReady ¶
OnSandboxReady implements sandboxpool.SandboxReadyHook. It is called in a goroutine; errors are logged but never propagated.
func (*Runner) OnSandboxRelease ¶ added in v0.0.7
OnSandboxRelease implements sandboxpool.SandboxReleaseHook. When the pod returns to the pool (Stopping → Idle), it resets the filter sidecar to fail-closed so a reused pod never carries the previous sandbox's egress rules into the window before the next claim's policy push lands.