Documentation
¶
Index ¶
Constants ¶
const (
// DefaultTraceDuration is the default duration in seconds for trace checks.
DefaultTraceDuration = 30
)
Variables ¶
This section is empty.
Functions ¶
func FormatResults ¶
func FormatResults(results []NodeResult) (output string, hasFailure bool)
FormatResults produces a consistent human-readable output and returns whether any check failed.
Types ¶
type Check ¶
type Check interface {
// Name returns the kebab-case identifier used as the subcommand name.
Name() string
// Description returns a short description for --help.
Description() string
// Mode returns whether this is a verify (point-in-time) or trace (duration) check.
Mode() Mode
// Command returns the shell command(s) to execute on the node.
// For trace checks, the framework substitutes {{.Duration}} with the
// user-specified --duration value in seconds.
Command() string
// Parse interprets the runtime result and returns a check Result.
Parse(res *pkgruntime.RunResult) (*Result, error)
}
Check is the interface every check must implement. The framework handles runtime selection, node targeting, cluster fan-out, cobra wiring, and result reporting. Contributors only implement this.
type IGCheck ¶
type IGCheck struct {
// GadgetImage is the gadget to run (e.g. "trace_dns", "trace_tcpretrans").
GadgetImage string
// OutputMode is the output format flag (default: "json").
OutputMode string
// Filters is a list of filter expressions joined by comma for --filter.
// It is recommended to use the filter to limit the data volume since
// azure-api runtime only has 4KB of output buffer.
Filters []string
// ExtraArgs are additional arguments appended after the filter flags.
ExtraArgs []string
}
IGCheck provides common command-building logic for checks that use the ig binary. Embed this in a check struct to automatically generate the ig command string.
type NodeResult ¶
NodeResult holds the outcome of running a check on a single node.
func RunOnNode ¶
func RunOnNode(ctx context.Context, c Check, rt pkgruntime.Runtime, nodeName string, timeout int, duration int) (*NodeResult, error)
RunOnNode executes a check on a single node using the given runtime.
func RunOnNodes ¶
func RunOnNodes(ctx context.Context, c Check, nodes []string, factory RuntimeFactory, timeout int, duration int) []NodeResult
RunOnNodes executes a check across multiple nodes in parallel.
type Result ¶
type Result struct {
Success bool
Message string // human-readable one-line summary
Details string // optional verbose output
}
Result represents the outcome of a single check on one node.
type RuntimeFactory ¶
type RuntimeFactory func(nodeName string) (pkgruntime.Runtime, error)
RuntimeFactory creates a runtime for a given node name. This allows the runner to be decoupled from the runtime construction details.