Documentation
¶
Overview ¶
Package validators provides shared utilities for v2 validator containers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run is the main entry point for v2 validator containers. It loads the context, dispatches to the named check, and handles exit codes and termination log writing.
Usage in main.go:
func main() {
validators.Run(map[string]validators.CheckFunc{
"operator-health": checkOperatorHealth,
"expected-resources": checkExpectedResources,
})
}
Types ¶
type CheckFunc ¶
CheckFunc is the signature for a v2 validator check function. Return nil for pass, non-nil error for fail, Skip() for skip. Evidence goes to stdout, debug logs to stderr.
type Context ¶
type Context struct {
// Ctx is the parent context with timeout.
Ctx context.Context
// Cancel releases resources. Must be called when done.
Cancel context.CancelFunc
// Clientset is the Kubernetes typed client.
Clientset kubernetes.Interface
// RESTConfig is the Kubernetes REST config (for exec, dynamic client, etc.).
RESTConfig *rest.Config
// DynamicClient is the Kubernetes dynamic client for CRD access.
DynamicClient dynamic.Interface
// Snapshot is the captured cluster state.
Snapshot *snapshotter.Snapshot
// Recipe is the recipe with validation configuration.
Recipe *recipe.RecipeResult
// Namespace is the validation namespace.
Namespace string
}
Context holds all dependencies for a validator check function.
func LoadContext ¶
LoadContext creates a Context from the v2 container environment. Reads snapshot and recipe from mounted ConfigMap paths. Builds a K8s client from in-cluster config or KUBECONFIG.
The caller MUST call ctx.Cancel() when done.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chainsaw executes Chainsaw-style assertions against a live Kubernetes cluster.
|
Package chainsaw executes Chainsaw-style assertions against a live Kubernetes cluster. |
|
conformance is a validator container for all conformance phase checks.
|
conformance is a validator container for all conformance phase checks. |
|
deployment is a validator container for all deployment phase checks.
|
deployment is a validator container for all deployment phase checks. |
|
Package helper provides shared utilities for v2 validator containers.
|
Package helper provides shared utilities for v2 validator containers. |
|
performance is a validator container for all performance phase checks.
|
performance is a validator container for all performance phase checks. |