chainsaw

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package chainsaw executes Chainsaw-style assertions against a live Kubernetes cluster. It uses the chainsaw Go library for field matching, replacing the previous exec-based chainsaw CLI invocation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentAssert

type ComponentAssert struct {
	// Name is the component name (e.g., "gpu-operator").
	Name string

	// AssertYAML is the raw Chainsaw assert file content.
	AssertYAML string
}

ComponentAssert holds the data needed to run assertions for one component.

type ResourceFetcher

type ResourceFetcher interface {
	// Fetch retrieves a Kubernetes resource as an unstructured map.
	Fetch(ctx context.Context, apiVersion, kind, namespace, name string) (map[string]interface{}, error)
}

ResourceFetcher abstracts fetching Kubernetes resources for testability.

func NewClusterFetcher

func NewClusterFetcher(client dynamic.Interface, mapper meta.RESTMapper) ResourceFetcher

NewClusterFetcher creates a ResourceFetcher that queries a live Kubernetes cluster.

type Result

type Result struct {
	// Component is the component name.
	Component string

	// Passed indicates whether the assertion passed.
	Passed bool

	// Output contains diagnostic detail for failures.
	Output string

	// Error contains any error from executing the assertion.
	Error error
}

Result holds the outcome of an assertion run for one component.

func Run

func Run(ctx context.Context, asserts []ComponentAssert, timeout time.Duration, fetcher ResourceFetcher) []Result

Run executes assertions for a set of components against live cluster resources. Components are run concurrently with bounded parallelism.

Jump to

Keyboard shortcuts

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