feat(validator): apply hybrid resource pattern to ValidatorCatalog#831
Merged
Conversation
Make ValidatorCatalog type support both standalone file usage and embedding in Kubernetes CRs by adding omitempty tags to APIVersion/Kind/Metadata fields and changing Metadata to pointer type. Changes: - Add omitempty tags to APIVersion and Kind fields - Change Metadata from CatalogMetadata to *CatalogMetadata (pointer) - Add omitempty tag to Metadata field - Keep Validators as required field (no omitempty) - Add nil check for Metadata in TestLoadEmbeddedCatalog - Add TestCatalogOmitEmpty to verify clean serialization without metadata - Add TestCatalogEmbedding to verify clean CR embedding - Import gopkg.in/yaml.v3 for YAML marshaling in tests This enables clean embedding without redundant metadata when used in CRs while supporting standalone catalog.yaml files with full resource metadata.
This comment was marked as resolved.
This comment was marked as resolved.
11 tasks
mchmarny
requested changes
May 11, 2026
mchmarny
left a comment
Member
There was a problem hiding this comment.
Mechanically the change is small and clean (omitempty tags + pointer Metadata + tests), and it mirrors the pattern from #830. Holding for the same shape-level concerns plus one use-case question:
- (a) Public type belongs in a dedicated
pkg/api/validator/v1package, not co-located with the orchestration code inpkg/validator/catalog. - (b)
apiVersion: aicr.nvidia.com/...implies a CRD group AICR doesn't ship — drop or explicitly scope as a non-binding example. - (d) Tag the package
v1alpha1with stability docs, notv1. - Confirm there's a real external consumer for the embed affordance before locking the pointer-Metadata change into the public API.
This PR and #830 set the public-API package shape together — recommend deciding both at once and re-landing as a single coherent Phase 1 change.
Unrelated nit: PR body has 🤖 Generated with [Claude Code] — repo policy in CLAUDE.md prohibits that attribution.
mchmarny
approved these changes
May 12, 2026
6 tasks
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
Moves
ValidatorCatalogtypes frompkg/validator/catalogtopkg/api/validator/v1and updates the API group tovalidator.nvidia.com/v1alpha1, consistent with the refactoring done forValidationInputin #830.Motivation/Context
Fixes #733
Related to #732 (ValidationInput refactoring)
Mark's review feedback requested:
pkg/api/validator/v1(same location as ValidationInput)aicr.nvidia.com/v1tovalidator.nvidia.com/v1alpha1omitemptytags (only YAML tags were present)Type of Change
Components Affected
pkg/api/validator/v1- New location for ValidatorCatalog typespkg/validator/catalog- Re-exports types for backward compatibilityrecipes/validators/catalog.yaml- Updated API versionImplementation Notes
New Structure
pkg/api/validator/v1/catalog.gowith all catalog types:ValidatorCatalogCatalogMetadataValidatorEntryResourceRequirementsEnvVarjsonandyamlomitemptytags to all optional fieldsForPhasemethod to v1 packageaicr.nvidia.com/v1tovalidator.nvidia.com/v1alpha1Backward Compatibility
pkg/validator/catalognow re-exports types as aliasesValidation Updates
validate()to allow embedded usage:Metadatais nil: APIVersion and Kind are optional (embedded usage)Metadatais present: APIVersion and Kind are required (standalone file)Test Updates
validator.nvidia.com/v1alpha1v1.CatalogAPIVersionandv1.CatalogKindconstantsTesting
Risk Assessment
Low Risk
Checklist