Skip to content

Commit

Permalink
fix: vuln scan success criteria met (#2292)
Browse files Browse the repository at this point in the history
* fix: k8s 1.31 Jobs can have SuccessCriteriaMet condition

* fix: k8s 1.31 jobs can have SuccessCriteriaMet condition - nodeCollector

* also handle failure condition

* orthogonal but please can we use the latest alpine?
  • Loading branch information
badgerspoke authored Nov 19, 2024
1 parent 6f3499c commit 48d87f4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/trivy-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.19.1
FROM alpine:3.19.4

RUN apk update

Expand Down
4 changes: 2 additions & 2 deletions pkg/configauditreport/controller/nodecollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ func (r *NodeCollectorJobController) reconcileJobs() reconcile.Func {
}

switch jobCondition := job.Status.Conditions[0].Type; jobCondition {
case batchv1.JobComplete:
case batchv1.JobComplete, batchv1.JobSuccessCriteriaMet:
err = r.processCompleteScanJob(ctx, job)
case batchv1.JobFailed:
case batchv1.JobFailed, batchv1.JobFailureTarget:
err = r.processFailedScanJob(ctx, job)
default:
err = fmt.Errorf("unrecognized scan job condition: %v", jobCondition)
Expand Down
2 changes: 1 addition & 1 deletion pkg/vulnerabilityreport/controller/scanjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r *ScanJobController) reconcileJobs() reconcile.Func {
}

switch jobCondition := job.Status.Conditions[0].Type; jobCondition {
case batchv1.JobComplete, batchv1.JobFailed:
case batchv1.JobComplete, batchv1.JobSuccessCriteriaMet, batchv1.JobFailed, batchv1.JobFailureTarget:
completedContainers, err := r.completedContainers(ctx, job)
if err != nil {
return ctrl.Result{}, r.deleteJob(ctx, job)
Expand Down

0 comments on commit 48d87f4

Please sign in to comment.