feat(validator): add per-check isolation and external validator support#299
Closed
xdu31 wants to merge 2 commits intoNVIDIA:mainfrom
Closed
feat(validator): add per-check isolation and external validator support#299xdu31 wants to merge 2 commits intoNVIDIA:mainfrom
xdu31 wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
9 tasks
mchmarny
requested changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add per-check isolation and external validator support to the validation framework. Recipe authors can now run individual checks/constraints in their own Kubernetes Jobs for fault isolation, and bring their own OCI containers as external validators.
Motivation
Today all checks in a phase run in a single Job. A crash or resource leak in one check kills the entire phase. This PR adds a cascading
isolatedflag (individual > phase > top-level > default false) that lets recipe authors control execution granularity, plus avalidatorsfield for external OCI containers.Recipe schema
Execution model
Changes
Recipe types (
pkg/recipe/metadata.go)CheckRefunion type (string or object) with customUnmarshalYAMLExternalValidatortype (name,image,timeout)Isolated *boolandTimeouttoConstraint,ValidationPhase,ValidationConfigValidationPhase.Checksfrom[]stringto[]CheckRef(backward compatible)Isolation logic (
pkg/validator/isolation.go— new)resolveIsolated(): cascading precedence (individual > phase > top-level > false)partitionByIsolation(): splits checks/constraints into shared vs isolated groupsPhase runners (
pkg/validator/phases_runners.go)executePhaseChecks()— central 3-tier orchestrator replacing duplicated logic in deployment/performance/conformance runnersrunExternalJob()for external validator JobssanitizeLabelValue,resolveItemTimeout,baseJobConfigJob agent (
pkg/validator/agent/)Labels map[string]stringtoConfig— structured pod labels (run-id,phase,tier,check/constraint/validator)ExternalCommandflag — omitsgo testcommand, uses container ENTRYPOINTTerminationMessageFallbackToLogsOnErrorpolicy for external Jobsapp.kubernetes.io/*labelsbatch.kubernetes.io/job-namefor pod lookup (Kubernetes-native, no custom label needed)RunID (
pkg/validator/validator.go)YYYYMMDD-HHMMSS-XXXX, 20 chars total)Results (
pkg/validator/result.go)Sourcefield (shared,isolated,external) toCheckResultDefaults (
pkg/defaults/timeouts.go)ExternalValidatorTimeout(10m) andExternalValidatorLogTailLines(10)Demo (
demos/isolation/)Dockerfile+check.sh)Structured pod labels
Each validation pod gets structured labels for querying:
aicr.nvidia.com/run-idaicr.nvidia.com/phaseaicr.nvidia.com/tiersharedisolatedexternalaicr.nvidia.com/checkaicr.nvidia.com/constraintaicr.nvidia.com/validatorFiles changed (24 files, +1702/−367)
pkg/recipe/metadata.goCheckRef,ExternalValidatortypes,Isolatedfieldspkg/recipe/metadata_test.goCheckRefYAML deserialization testspkg/recipe/conformance_test.goCheckRefpkg/validator/isolation.gopkg/validator/isolation_test.gopkg/validator/phases_runners.gopkg/validator/phases_test.gopkg/validator/result.goSourcefield,CheckSource*constantspkg/validator/validator.gopkg/validator/validator_test.gopkg/validator/agent/types.goLabels,ExternalCommand,Cleanupfieldspkg/validator/agent/job.gopkg/validator/agent/job_test.gopkg/validator/agent/wait.gobatch.kubernetes.io/job-namepod lookuppkg/validator/agent/wait_test.gopkg/validator/checks/runner.goCheckRefcompatibilitypkg/validator/checks/runner_test.goCheckRefpkg/validator/README.mdpkg/defaults/timeouts.godemos/isolation/README.mddemos/isolation/recipe.yamldemos/isolation/result.yamldemos/isolation/external-validator/Dockerfiledemos/isolation/external-validator/check.shTest plan
make test(unit tests with race detector)make lint(0 issues)checks: ["expected-resources"]still works