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: Deleting a VulnerabilityReport should trigger rescan #458

Merged
merged 1 commit into from
Mar 29, 2021

Conversation

danielpacak
Copy link
Contributor

Resolves: #414
Resolves: #451

Signed-off-by: Daniel Pacak pacak.daniel@gmail.com

@codecov
Copy link

codecov bot commented Mar 25, 2021

Codecov Report

Merging #458 (2fff116) into main (2060f7b) will increase coverage by 0.57%.
The diff coverage is 82.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #458      +/-   ##
==========================================
+ Coverage   69.41%   69.99%   +0.57%     
==========================================
  Files          58       58              
  Lines        3551     3579      +28     
==========================================
+ Hits         2465     2505      +40     
+ Misses        801      792       -9     
+ Partials      285      282       -3     
Impacted Files Coverage Δ
pkg/kube/resources.go 100.00% <ø> (ø)
pkg/operator/predicate/predicate.go 92.00% <ø> (-0.73%) ⬇️
pkg/operator/controller/configauditreport.go 67.56% <50.00%> (+2.80%) ⬆️
pkg/operator/controller/vulnerabilityreport.go 68.31% <81.66%> (+7.09%) ⬆️
itest/matcher/matcher.go 84.00% <100.00%> (+0.43%) ⬆️
pkg/operator/controller/ciskubebenchreport.go 67.20% <100.00%> (+2.53%) ⬆️
pkg/vulnerabilityreport/builder.go 79.48% <100.00%> (ø)

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 2060f7b...2fff116. Read the comment docs.

@danielpacak danielpacak force-pushed the issue_414_rescan_vulns branch 2 times, most recently from 24fa807 to 8e9de4c Compare March 25, 2021 14:08
@danielpacak danielpacak marked this pull request as ready for review March 25, 2021 15:02
Kind: "Pod",
Name: podName,
UID: pod.UID,
APIVersion: "v1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create a custom Gomega matcher to assert valid VulnerabilityReports controlled by the given workload

@danielpacak danielpacak requested a review from itaysk March 25, 2021 15:05
@@ -92,7 +92,7 @@ func (b *builder) Get() (v1alpha1.VulnerabilityReport, error) {
},
Report: b.result,
}
err = controllerutil.SetOwnerReference(b.owner, &report, b.scheme)
err = controllerutil.SetControllerReference(b.owner, &report, b.scheme)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is required to use controller-runtime factories out of the box:

err = ctrl.NewControllerManagedBy(mgr).
	For(&appv1.ReplicaSet{}).
	Owns(&v1alpa1.VulnerabilityReport{}). // whenever we delete vulnerability report owned by a ReplicaSet, the ReplicaSet gets reconciled
	Complete(r.reconcileWorkload(workload.kind))

Resolves: #414
Resolves: #451

Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
@danielpacak danielpacak merged commit 20182e2 into main Mar 29, 2021
@danielpacak danielpacak deleted the issue_414_rescan_vulns branch March 29, 2021 18:49
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.

Assign VulnerabilityReports to CronJob instead of Jobs Deleting a VulnerabilityReport should trigger rescan
2 participants