verifier

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package verifier evaluates scenario outcome quality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgoCDAppHealthyCheck

type ArgoCDAppHealthyCheck struct {
	Name string
}

ArgoCDAppHealthyCheck verifies an Argo CD application is healthy and synced.

func (*ArgoCDAppHealthyCheck) Check

func (c *ArgoCDAppHealthyCheck) Check(ctx context.Context, kubeconfigPath string) CheckResult

Check runs argocd or kubectl to verify app health.

func (*ArgoCDAppHealthyCheck) Validate

func (c *ArgoCDAppHealthyCheck) Validate() error

Validate checks that required fields are set.

type CheckDef

type CheckDef struct {
	Type      string
	Namespace string
	Name      string
	Condition string
}

CheckDef is the check definition accepted by BuildCheckers. It mirrors scenario.Check to avoid a package dependency cycle.

type CheckResult

type CheckResult struct {
	Name    string  `json:"name"`
	Type    string  `json:"type"`
	Verdict Verdict `json:"verdict"`
	Message string  `json:"message,omitempty"`
}

CheckResult holds the result of a single verification check.

type Checker

type Checker interface {
	Check(ctx context.Context, kubeconfigPath string) CheckResult
}

Checker runs a single verification check against the cluster.

func BuildCheckers

func BuildCheckers(checks []CheckDef) ([]Checker, error)

BuildCheckers creates Checker instances from check definitions.

type CommandSucceedsCheck

type CommandSucceedsCheck struct {
	Name    string
	Command string // path to script or command to run
}

CommandSucceedsCheck runs a script and passes if it exits 0.

func (*CommandSucceedsCheck) Check

func (c *CommandSucceedsCheck) Check(ctx context.Context, kubeconfigPath string) CheckResult

Check runs the command and returns pass if it exits 0.

func (*CommandSucceedsCheck) Validate

func (c *CommandSucceedsCheck) Validate() error

Validate checks that required fields are set.

type DeploymentReadyCheck

type DeploymentReadyCheck struct {
	Namespace string
	Name      string
}

DeploymentReadyCheck verifies a deployment has all replicas ready.

func (*DeploymentReadyCheck) Check

func (c *DeploymentReadyCheck) Check(ctx context.Context, kubeconfigPath string) CheckResult

Check runs kubectl to verify the deployment is ready.

func (*DeploymentReadyCheck) Validate

func (c *DeploymentReadyCheck) Validate() error

Validate checks that required fields are set.

type HelmReleaseCheck

type HelmReleaseCheck struct {
	Namespace string
	Name      string
}

HelmReleaseCheck verifies a Helm release is deployed.

func (*HelmReleaseCheck) Check

func (c *HelmReleaseCheck) Check(ctx context.Context, kubeconfigPath string) CheckResult

Check runs helm to verify the release exists and is deployed.

func (*HelmReleaseCheck) Validate

func (c *HelmReleaseCheck) Validate() error

Validate checks that required fields are set.

type ResourceExistsCheck

type ResourceExistsCheck struct {
	Namespace string
	Name      string
	Kind      string // e.g. "NetworkPolicy", "PodDisruptionBudget"
}

ResourceExistsCheck verifies a specific Kubernetes resource still exists.

func (*ResourceExistsCheck) Check

func (c *ResourceExistsCheck) Check(ctx context.Context, kubeconfigPath string) CheckResult

Check runs kubectl to verify the resource exists.

func (*ResourceExistsCheck) Validate

func (c *ResourceExistsCheck) Validate() error

Validate checks that required fields are set.

type ServiceEndpointsCheck

type ServiceEndpointsCheck struct {
	Namespace string
	Name      string
}

ServiceEndpointsCheck verifies a service has at least one endpoint.

func (*ServiceEndpointsCheck) Check

func (c *ServiceEndpointsCheck) Check(ctx context.Context, kubeconfigPath string) CheckResult

Check runs kubectl to verify the service has endpoints.

func (*ServiceEndpointsCheck) Validate

func (c *ServiceEndpointsCheck) Validate() error

Validate checks that required fields are set.

type ServiceReachableCheck

type ServiceReachableCheck struct {
	Namespace string
	Name      string
	SourcePod string
}

ServiceReachableCheck verifies a service is reachable from a probe pod inside the cluster.

func (*ServiceReachableCheck) Check

func (c *ServiceReachableCheck) Check(ctx context.Context, kubeconfigPath string) CheckResult

Check runs kubectl exec from the probe pod and verifies an HTTP request succeeds.

func (*ServiceReachableCheck) Validate

func (c *ServiceReachableCheck) Validate() error

Validate checks that required fields are set.

type Verdict

type Verdict string

Verdict is the outcome of a verification check.

const (
	VerdictPass Verdict = "pass"
	VerdictFail Verdict = "fail"
	VerdictSkip Verdict = "skip"
)

type VerifyResult

type VerifyResult struct {
	Passed bool          `json:"passed"`
	Checks []CheckResult `json:"checks"`
}

VerifyResult holds the aggregate verification result.

func PollChecks

func PollChecks(ctx context.Context, kubeconfigPath string, checkers []Checker, interval time.Duration) *VerifyResult

PollChecks runs all checkers in a loop until all pass or the context is cancelled. It polls at the given interval. Returns the last VerifyResult.

func RunChecks

func RunChecks(ctx context.Context, kubeconfigPath string, checkers []Checker) *VerifyResult

RunChecks executes all checkers and returns the aggregate result.

Jump to

Keyboard shortcuts

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