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
- Variables
- type Option
- func WithCleanup(cleanup bool) Option
- func WithCommit(commit string) Option
- func WithImagePullSecrets(secrets []string) Option
- func WithNamespace(namespace string) Option
- func WithNoCluster(noCluster bool) Option
- func WithNodeSelector(nodeSelector map[string]string) Option
- func WithRunID(runID string) Option
- func WithTolerations(tolerations []corev1.Toleration) Option
- func WithVersion(version string) Option
- type Phase
- type PhaseResult
- type Validator
Constants ¶
const ( PhaseDeployment = v1.PhaseDeployment PhasePerformance = v1.PhasePerformance PhaseConformance = v1.PhaseConformance )
Re-exported constants from pkg/api/validator/v1 for backward compatibility.
const PhaseAll = "all"
PhaseAll is the wildcard string accepted by both the `aicr validate --phase` CLI flag and the spec.validate.execution.phases config field to mean "run every phase." It is not a Phase value — the CLI parser collapses it into a nil selection that ValidatePhases interprets as "run all phases."
Variables ¶
var PhaseNames = []string{ string(PhaseDeployment), string(PhasePerformance), string(PhaseConformance), PhaseAll, }
PhaseNames is the canonical user-facing vocabulary accepted by the --phase flag and spec.validate.execution.phases. The typed Phase constants in PhaseOrder plus the PhaseAll wildcard. Single source of truth so the CLI parser and the config-load validator stay in sync when a phase is added or removed.
var PhaseOrder = []Phase{PhaseDeployment, PhasePerformance, PhaseConformance}
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 ¶
WithCleanup controls whether to delete Jobs, ConfigMaps, and RBAC after validation. Default: true.
func WithCommit ¶ added in v0.12.0
WithCommit sets the git commit SHA (typically the CLI build commit). Used for resolving dev-build validator images to SHA-tagged images.
func WithImagePullSecrets ¶
WithImagePullSecrets sets image pull secrets for validator Jobs.
func WithNamespace ¶
WithNamespace sets the Kubernetes namespace for validation Jobs. Default: "aicr-validation".
func WithNoCluster ¶
WithNoCluster controls cluster access. When true, all validators are reported as skipped and no K8s API calls are made. Default: false.
func WithNodeSelector ¶ added in v0.12.0
WithNodeSelector sets node selector labels to override inner workload scheduling. When set, validators pass these selectors to the workloads they create (e.g., NCCL benchmark pods), replacing platform-specific defaults. Does not affect the orchestrator Job.
func WithRunID ¶
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 to override inner workload scheduling. When set, validators pass these tolerations to the workloads they create (e.g., NCCL benchmark pods), replacing default tolerate-all policy. Does not affect the orchestrator Job.
func WithVersion ¶
WithVersion sets the validator version string (typically the CLI version).
type Phase ¶ added in v0.9.0
Re-exported type from pkg/api/validator/v1 for backward compatibility.
func ParsePhase ¶ added in v0.13.0
ParsePhase converts a user-facing phase name to its typed Phase value. Returns false for PhaseAll (the wildcard, which has no Phase value) and for unrecognized inputs. Callers that want to accept the wildcard handle it separately, typically by collapsing the whole selection to nil (= run every phase).
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
// Commit is the git commit SHA from the CLI build. Used to resolve
// dev-build validator images to SHA-tagged images pushed by on-push CI.
Commit 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 passed to validation workloads (e.g., NCCL benchmark pods)
// to override their default scheduling constraints. Does not affect the
// orchestrator Job itself.
Tolerations []corev1.Toleration
// NodeSelector is passed to validation workloads (e.g., NCCL benchmark pods)
// to override platform-specific node selectors. Use when GPU nodes have
// non-standard labels. Does not affect the orchestrator Job itself.
NodeSelector map[string]string
}
Validator orchestrates validation runs using containerized validators.
func (*Validator) ValidatePhase ¶
func (v *Validator) ValidatePhase( ctx context.Context, phase Phase, validationInput *v1.ValidationInput, snap *snapshotter.Snapshot, ) (*PhaseResult, error)
ValidatePhase runs a single validation phase.
func (*Validator) ValidatePhases ¶
func (v *Validator) ValidatePhases( ctx context.Context, phases []Phase, validationInput *v1.ValidationInput, 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. |