diff --git a/pkg/operator/controller/ciskubebenchreport.go b/pkg/operator/controller/ciskubebenchreport.go index bc23b85bf..9783f414b 100644 --- a/pkg/operator/controller/ciskubebenchreport.go +++ b/pkg/operator/controller/ciskubebenchreport.go @@ -280,6 +280,10 @@ func (r *CISKubeBenchReportReconciler) processCompleteScanJob(ctx context.Contex logsStream, err := r.LogsReader.GetLogsByJobAndContainerName(ctx, job, r.Plugin.GetContainerName()) if err != nil { + if errors.IsNotFound(err) { + log.V(1).Info("Cached job must have been deleted") + return nil + } if kube.IsPodControlledByJobNotFound(err) { log.V(1).Info("Pod must have been deleted") return r.deleteJob(ctx, job) @@ -325,6 +329,10 @@ func (r *CISKubeBenchReportReconciler) processFailedScanJob(ctx context.Context, statuses, err := r.LogsReader.GetTerminatedContainersStatusesByJob(ctx, job) if err != nil { + if errors.IsNotFound(err) { + log.V(1).Info("Cached job must have been deleted") + return nil + } if kube.IsPodControlledByJobNotFound(err) { log.V(1).Info("Pod must have been deleted") return r.deleteJob(ctx, job) diff --git a/pkg/operator/controller/configauditreport.go b/pkg/operator/controller/configauditreport.go index 3b347d7e5..79f2abc97 100644 --- a/pkg/operator/controller/configauditreport.go +++ b/pkg/operator/controller/configauditreport.go @@ -409,6 +409,10 @@ func (r *ConfigAuditReportReconciler) processCompleteScanJob(ctx context.Context logsStream, err := r.LogsReader.GetLogsByJobAndContainerName(ctx, job, r.Plugin.GetContainerName()) if err != nil { + if errors.IsNotFound(err) { + log.V(1).Info("Cached job must have been deleted") + return nil + } if kube.IsPodControlledByJobNotFound(err) { log.V(1).Info("Pod must have been deleted") return r.deleteJob(ctx, job) @@ -443,6 +447,10 @@ func (r *ConfigAuditReportReconciler) processFailedScanJob(ctx context.Context, statuses, err := r.LogsReader.GetTerminatedContainersStatusesByJob(ctx, scanJob) if err != nil { + if errors.IsNotFound(err) { + log.V(1).Info("Cached job must have been deleted") + return nil + } if kube.IsPodControlledByJobNotFound(err) { log.V(1).Info("Pod must have been deleted") return r.deleteJob(ctx, scanJob) diff --git a/pkg/operator/controller/vulnerabilityreport.go b/pkg/operator/controller/vulnerabilityreport.go index c739de550..798d3d787 100644 --- a/pkg/operator/controller/vulnerabilityreport.go +++ b/pkg/operator/controller/vulnerabilityreport.go @@ -370,6 +370,10 @@ func (r *VulnerabilityReportReconciler) processCompleteScanJob(ctx context.Conte for containerName, containerImage := range containerImages { logsStream, err := r.LogsReader.GetLogsByJobAndContainerName(ctx, job, containerName) if err != nil { + if k8sapierror.IsNotFound(err) { + log.V(1).Info("Cached job must have been deleted") + return nil + } if kube.IsPodControlledByJobNotFound(err) { log.V(1).Info("Pod must have been deleted") return r.deleteJob(ctx, job) @@ -415,6 +419,10 @@ func (r *VulnerabilityReportReconciler) processFailedScanJob(ctx context.Context statuses, err := r.GetTerminatedContainersStatusesByJob(ctx, scanJob) if err != nil { + if k8sapierror.IsNotFound(err) { + log.V(1).Info("Cached job must have been deleted") + return nil + } if kube.IsPodControlledByJobNotFound(err) { log.V(1).Info("Pod must have been deleted") return r.deleteJob(ctx, scanJob)