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

feat: support direct rule evaluation with validator check --direct #127

Merged
merged 20 commits into from
Aug 6, 2024

Conversation

TylerGillson
Copy link
Member

@TylerGillson TylerGillson commented Aug 5, 2024

Issue

Resolves #102

Description

Adds --direct flag for validator check. In direct mode, no K8s cluster is required.

Instead, plugin rules are evaluated directly, in-process. Results are both saved to disk and printed to the console.

… edge cases & fix FatalCLI calls

Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
@TylerGillson TylerGillson marked this pull request as ready for review August 6, 2024 00:49
@TylerGillson TylerGillson requested a review from a team as a code owner August 6, 2024 00:49
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. new-feature Net-new feature labels Aug 6, 2024
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Copy link

codecov bot commented Aug 6, 2024

Codecov Report

Attention: Patch coverage is 41.89189% with 301 lines in your changes missing coverage. Please review.

Files Patch % Lines
pkg/services/validator/validator_service.go 29.16% 64 Missing and 21 partials ⚠️
pkg/services/validator/network.go 5.97% 61 Missing and 2 partials ⚠️
pkg/cmd/validator/validator.go 62.41% 44 Missing and 12 partials ⚠️
pkg/components/validator.go 50.84% 19 Missing and 10 partials ⚠️
cmd/validator.go 31.57% 8 Missing and 5 partials ⚠️
pkg/services/validator/oci.go 13.33% 12 Missing and 1 partial ⚠️
pkg/services/validator/vmware.go 47.05% 4 Missing and 5 partials ⚠️
pkg/utils/kube/kube.go 52.94% 4 Missing and 4 partials ⚠️
pkg/services/validator/aws.go 46.15% 3 Missing and 4 partials ⚠️
pkg/services/validator/azure.go 41.66% 3 Missing and 4 partials ⚠️
... and 4 more
@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
+ Coverage   36.86%   37.60%   +0.74%     
==========================================
  Files          44       44              
  Lines        5119     5435     +316     
==========================================
+ Hits         1887     2044     +157     
- Misses       2885     3005     +120     
- Partials      347      386      +39     
Files Coverage Δ
pkg/config/config.go 66.03% <ø> (ø)
pkg/utils/cmd/cmd.go 33.33% <0.00%> (ø)
pkg/utils/exec/exec.go 44.06% <50.00%> (-6.68%) ⬇️
cmd/root.go 77.77% <0.00%> (+2.77%) ⬆️
...integration/_validator/testcases/test_validator.go 92.90% <78.26%> (-0.55%) ⬇️
pkg/services/validator/aws.go 14.39% <46.15%> (+0.24%) ⬆️
pkg/services/validator/azure.go 9.69% <41.66%> (+1.10%) ⬆️
pkg/utils/kube/kube.go 51.13% <52.94%> (-0.26%) ⬇️
pkg/services/validator/vmware.go 11.28% <47.05%> (+0.27%) ⬆️
cmd/validator.go 76.82% <31.57%> (-2.65%) ⬇️
... and 5 more

Continue to review full report in Codecov by Sentry.

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

Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 6, 2024
@TylerGillson TylerGillson merged commit f1fb0d6 into main Aug 6, 2024
8 checks passed
@TylerGillson TylerGillson deleted the feat/check-direct branch August 6, 2024 19:00
TylerGillson added a commit that referenced this pull request Aug 6, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.1.0](v0.0.6...v0.1.0)
(2024-08-06)


### ⚠ BREAKING CHANGES

* split plugin rule configuration and installation into separate
commands
([#121](#121))

### Features

* add docs command; refactor to use embeddedfs pkg
([#116](#116))
([dbe19c5](dbe19c5))
* read CA certs for network rules, add HTTPFileRules, AMIRules
([#117](#117))
([0c4487f](0c4487f))
* support direct rule evaluation with `validator check --direct`
([#127](#127))
([f1fb0d6](f1fb0d6))


### Docs

* added subcommands docs page
([#110](#110))
([9fa23dc](9fa23dc))


### Dependency Updates

* **deps:** update github.com/validator-labs/validator-plugin-azure
digest to ba947e3
([#134](#134))
([2a1058d](2a1058d))
* **deps:** update github.com/validator-labs/validator-plugin-vsphere
digest to 9b1f05b
([#135](#135))
([253f328](253f328))


### Refactoring

* remove -s flag
([#126](#126))
([9373e02](9373e02))
* simplify helm prompts
([#115](#115))
([8ce75a1](8ce75a1))
* split plugin rule configuration and installation into separate
commands
([#121](#121))
([6eaee77](6eaee77))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer new-feature Net-new feature size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ Implement validator check --direct
2 participants