Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make validator and defaulter more extensible #1507

Merged
merged 3 commits into from
May 26, 2021

Conversation

matthchr
Copy link
Member

@matthchr matthchr commented May 24, 2021

As the code generator gets fully fleshed out, we're running into cases where we need to perform special validation or defaulting logic on all resources. Additionally, the ability to manually add to validations/defaults for certain resources will be needed.

See https://github.com/Azure/azure-service-operator/blob/master/docs/design/defaulter-validator.md for the design of this feature.

Closes #1430

@matthchr
Copy link
Member Author

matthchr commented May 24, 2021

I know this looks like a pretty large PR, but ~2300 lines are golden files and ~200 are just moving code to a new file, so there's really only 600 lines of new code here.

@codecov-commenter
Copy link

codecov-commenter commented May 24, 2021

Codecov Report

Merging #1507 (7eb179d) into master (0423ffd) will increase coverage by 0.92%.
The diff coverage is 91.01%.

❗ Current head 7eb179d differs from pull request most recent head 6fc2b85. Consider uploading reports for the commit 6fc2b85 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1507      +/-   ##
==========================================
+ Coverage   62.81%   63.73%   +0.92%     
==========================================
  Files         165      169       +4     
  Lines       10925    11265     +340     
==========================================
+ Hits         6862     7180     +318     
- Misses       3419     3436      +17     
- Partials      644      649       +5     
Impacted Files Coverage Δ
hack/generator/pkg/astbuilder/calls.go 89.47% <ø> (+10.52%) ⬆️
...kg/astmodel/object_type_serialization_test_case.go 2.08% <0.00%> (ø)
...rator/pkg/codegen/pipeline_create_storage_types.go 3.15% <0.00%> (ø)
...enerator/pkg/codegen/resource_registration_file.go 0.00% <0.00%> (ø)
hack/generator/pkg/astmodel/function.go 37.50% <37.50%> (ø)
...or/pkg/astmodel/kubernetes_admissions_validator.go 92.40% <92.40%> (ø)
...or/pkg/astmodel/kubernetes_admissions_defaulter.go 95.60% <95.60%> (ø)
hack/generator/pkg/astbuilder/assignments.go 100.00% <100.00%> (ø)
hack/generator/pkg/astbuilder/builder.go 84.71% <100.00%> (+0.09%) ⬆️
hack/generator/pkg/astmodel/arm_spec_interface.go 91.39% <100.00%> (+0.28%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0423ffd...6fc2b85. Read the comment docs.

@matthchr matthchr force-pushed the feature/validator-defaulter branch from e39f086 to 7eb179d Compare May 24, 2021 17:35
@matthchr matthchr force-pushed the feature/validator-defaulter branch from 7eb179d to 6fc2b85 Compare May 24, 2021 17:38
@Porges
Copy link
Member

Porges commented May 24, 2021

Closes #1430?

@matthchr
Copy link
Member Author

So it does! Added to the description

@matthchr matthchr merged commit 7a9f076 into Azure:master May 26, 2021
@matthchr matthchr deleted the feature/validator-defaulter branch May 26, 2021 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Defaulting and Validating handlers should be extensible
3 participants