validator

package
v0.10.16 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package validator provides a container-per-validator execution engine for AICR cluster validation. Each validator is an OCI container image run as a Kubernetes Job, communicating results via exit codes and termination messages.

Index

Constants

This section is empty.

Variables

PhaseOrder defines the mandatory execution order. If a phase fails, subsequent phases are skipped.

Note: Readiness phase is NOT included. It remains in pkg/validator and uses inline constraint evaluation (no containers).

Functions

This section is empty.

Types

type Option

type Option func(*Validator)

Option is a functional option for configuring Validator instances.

func WithCleanup

func WithCleanup(cleanup bool) Option

WithCleanup controls whether to delete Jobs, ConfigMaps, and RBAC after validation. Default: true.

func WithImagePullSecrets

func WithImagePullSecrets(secrets []string) Option

WithImagePullSecrets sets image pull secrets for validator Jobs.

func WithNamespace

func WithNamespace(namespace string) Option

WithNamespace sets the Kubernetes namespace for validation Jobs. Default: "aicr-validation".

func WithNoCluster

func WithNoCluster(noCluster bool) Option

WithNoCluster controls cluster access. When true, all validators are reported as skipped and no K8s API calls are made. Default: false.

func WithRunID

func WithRunID(runID string) Option

WithRunID sets the RunID for this validation run. Used when resuming a previous run.

func WithTolerations added in v0.8.2

func WithTolerations(tolerations []corev1.Toleration) Option

WithTolerations sets tolerations for validator Jobs. Default: tolerate-all.

func WithVersion

func WithVersion(version string) Option

WithVersion sets the validator version string (typically the CLI version).

type Phase added in v0.9.0

type Phase string

Phase represents a validation phase.

const (
	// PhaseDeployment validates that components are deployed and healthy.
	PhaseDeployment Phase = "deployment"

	// PhasePerformance runs GPU performance benchmarks.
	PhasePerformance Phase = "performance"

	// PhaseConformance verifies Kubernetes API conformance requirements.
	PhaseConformance Phase = "conformance"
)

type PhaseResult

type PhaseResult struct {
	// Phase is the phase that was executed.
	Phase Phase

	// Status is the overall phase status derived from the CTRF summary.
	Status string

	// Report is the CTRF report for this phase.
	Report *ctrf.Report

	// Duration is the wall-clock time for the entire phase.
	Duration time.Duration
}

PhaseResult is the outcome of running all validators in a single phase.

type Validator

type Validator struct {
	// Version is the validator version (typically the CLI version).
	Version string

	// Namespace is the Kubernetes namespace for validation Jobs.
	Namespace string

	// RunID is a unique identifier for this validation run.
	RunID string

	// Cleanup controls whether to delete Jobs, ConfigMaps, and RBAC after validation.
	Cleanup bool

	// ImagePullSecrets are secret names for pulling validator images.
	ImagePullSecrets []string

	// NoCluster controls whether to skip cluster operations (dry-run mode).
	NoCluster bool

	// Tolerations are applied to validator Jobs for scheduling.
	Tolerations []corev1.Toleration
}

Validator orchestrates validation runs using containerized validators.

func New

func New(opts ...Option) *Validator

New creates a new Validator with the provided options.

func (*Validator) ValidatePhase

func (v *Validator) ValidatePhase(
	ctx context.Context,
	phase Phase,
	recipeResult *recipe.RecipeResult,
	snap *snapshotter.Snapshot,
) (*PhaseResult, error)

ValidatePhase runs a single validation phase.

func (*Validator) ValidatePhases

func (v *Validator) ValidatePhases(
	ctx context.Context,
	phases []Phase,
	recipeResult *recipe.RecipeResult,
	snap *snapshotter.Snapshot,
) ([]*PhaseResult, error)

ValidatePhases runs the specified phases sequentially. If a phase fails, subsequent phases are skipped. Returns one PhaseResult per phase. Pass nil or empty phases to run all phases.

Directories

Path Synopsis
Package catalog provides the declarative validator catalog.
Package catalog provides the declarative validator catalog.
Package ctrf provides Go types and utilities for the Common Test Report Format (CTRF).
Package ctrf provides Go types and utilities for the Common Test Report Format (CTRF).
Package labels provides shared label constants for validation resources.
Package labels provides shared label constants for validation resources.

Jump to

Keyboard shortcuts

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