feat(recipe): extract Validation as standalone type with hybrid resource pattern#830
Merged
mchmarny merged 10 commits intoMay 12, 2026
Merged
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
xdu31
added a commit
to xdu31/aicr
that referenced
this pull request
May 10, 2026
The E2E action builds validator images with :latest tag but the validator catalog resolution defaults to :sha-<commit> when AICR_VALIDATOR_IMAGE_TAG is not set. This causes ImagePullBackOff errors and validator jobs to report 'pod not found' with status 'other'. Setting AICR_VALIDATOR_IMAGE_TAG=latest ensures the validator jobs use the locally-built images that are available in the Kind registry. Fixes the E2E test failures in NVIDIA#830 where all validators were reporting status 'other' instead of pass/fail.
df4cae7 to
17778ce
Compare
17778ce to
6440b40
Compare
10 tasks
00751ff to
a336a2d
Compare
Contributor
|
@xdu31 this PR now has merge conflicts with |
Make Validation type support both standalone file usage and embedding in Kubernetes CRs by adding optional APIVersion/Kind/Metadata fields with omitempty tags. Changes: - Add APIVersion, Kind, and Metadata fields to Validation struct - Use custom ValidationMetadata type instead of metav1.ObjectMeta - Add omitempty tags to all optional fields (APIVersion, Kind, Metadata, ComponentRefs, Criteria, Constraints) - Update ToValidation() to populate resource metadata from RecipeResult - Update NewValidation() to initialize with zero values - Update tests to verify resource metadata handling This enables clean embedding without redundant metadata when used in CRs while supporting standalone validation.yaml files with full resource metadata.
- Add KindValidation constant to fix goconst warning - Format files with gofmt to fix formatting issues - Update tests to use constant instead of string literal
The PR changed validator.go to store Validation in ConfigMap with name aicr-validation-<runID> and key validation.yaml, but deployer.go and validators/context.go were not updated to match. This caused 'pod not found for Job' error because: - validator.go creates ConfigMap: aicr-validation-<runID> - deployer.go tries to mount: aicr-recipe-<runID> (doesn't exist) - Kubernetes cannot create Pod without the required ConfigMap Changes: - deployer.go: Mount aicr-validation-* ConfigMap at /data/validation/ - deployer.go: Update env var AICR_RECIPE_PATH → AICR_VALIDATION_PATH - validators/context.go: Load Validation directly instead of RecipeResult This completes the Validation extraction by updating all references to use the new ConfigMap name and structure.
a336a2d to
3163c93
Compare
mchmarny
approved these changes
May 12, 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
Extracts
Validationas a standalone type fromRecipeResultand implements a hybrid resource pattern that supports both standalone file usage (with full Kubernetes resource metadata) and clean embedding in Custom Resources (with metadata auto-omitted viaomitemptytags).Motivation/Context
Fixes #732
The Validation configuration was previously embedded within RecipeResult, making it difficult to:
This change enables the same
Validationtype to work seamlessly in both contexts:Type of Change
Components Affected
pkg/recipe- New validation.go and validation_test.gopkg/validator- Updated to use standalone Validation typepkg/cli- Updated validate commandvalidators/*- 16 validator implementations updatedImplementation Notes
New Files
pkg/recipe/validation.go(161 lines) - Standalone Validation type with:omitemptyValidationMetadatatype (lighter than metav1.ObjectMeta)KindValidationconstant for type safetyToValidation()converter from RecipeResultNewValidation()constructorpkg/recipe/validation_test.go(310 lines) - Comprehensive test coverage:Key Design Decisions
spec.validation.specValidationMetadatainstead of heavymetav1.ObjectMetaRemoved from RecipeResult
Validation *ValidationConfigfield moved to standalone typeTesting
Test Coverage Details
New tests verify:
Risk Assessment
Low Risk
Checklist