feat(validations): Add early range based pattern validation#5115
feat(validations): Add early range based pattern validation#5115AdarshK15 merged 9 commits intoGoogleCloudPlatform:developfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new range validator, which is a valuable addition for validating blueprint configurations. The implementation is well-structured and includes a beneficial refactoring of existing validators for better consistency. My review has identified two points for improvement: a minor typo in a user-facing error message and, more significantly, the absence of unit tests for the new RangeValidator. Adding comprehensive tests is crucial to ensure the feature's correctness and long-term maintainability, as per the project's contribution guidelines.
community/modules/scheduler/schedmd-slurm-gcp-v6-controller/metadata.yaml
Outdated
Show resolved
Hide resolved
|
/gemini summary |
|
/gemini review |
Summary of ChangesThis pull request significantly enhances the module-scoped validation framework by introducing a new Highlights
Changelog
Activity
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable range validator, significantly enhancing the validation framework. The implementation is clean, and it's great to see it immediately applied to various modules, complete with unit tests and documentation. I have a few suggestions to improve the robustness of the new validator.
7ec39e9
into
GoogleCloudPlatform:develop
Summary
This PR introduces the range validator to the module-scoped validation framework and applies it to several core and community modules. By moving numeric and length validation into metadata.yaml files, these constraints are caught earlier in the deployment lifecycle.
Key Changes
New RangeValidator: Implements a generic validator to enforce numeric boundaries or length constraints on module settings.
Functionality:
- Numeric Bounds: Supports min and max checks for integer values.
- Length Handling: Includes a length_check flag to validate the size of a list; instead of the raw value.
Changes:
Added range validation for the following modules:
- compute/gke-nodeset: Validates count of entries in network_storage and filestore_id.
- compute/mig: Ensures at least one version is provided.
- scheduler/htcondor-access-point: Limits the number of zones.
- scheduler/schedmd-slurm-gcp-v6-controller: Limits the number of static IPs to a maximum of 1.
- compute/gke-node-pool: Enforces valid upgrade settings count ranges.
- internal/slurm-gcp/nodeset_tpu: Enforces valid node count ranges.
- network/multivpc: Enforces a network count between 2 and 8.
- file-system/filestore: Enforces minimum capacity requirements.
Added regex validation for the following modules:
- database/slurm-cloudsql-federation: Validates network_id to ensure the correct path format.
- modules/file-system/filestore: Validates network_id to ensure the correct path format.
- modules/file-system/parallelstore: Validates network_id to ensure the correct path format.
- modules/scheduler/gke-cluster: Validates network_id to ensure the correct path format.
- database/slurm-cloudsql-federation: Validates network_id to ensure the correct path format.
- compute/notebook: Validates mount_runner.args to ensure 5 elements.
Testing
Added unit tests covering numeric ranges, list of ints, and also list length validation scenarios.
Documentation
Updated docs/blueprint-validation.md to include usage instructions and examples for the new validator.