Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 03f2a1b

Browse files
committed
Add auto discovery ignore annotations to scan related pods
1 parent f9d8f8f commit 03f2a1b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

operator/controllers/execution/scan_controller.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
326326
Spec: batch.JobSpec{
327327
BackoffLimit: &backOffLimit,
328328
Template: corev1.PodTemplateSpec{
329+
ObjectMeta: metav1.ObjectMeta{
330+
Annotations: map[string]string{
331+
"auto-discovery.experimental.securecodebox.io/ignore": "true",
332+
},
333+
},
329334
Spec: corev1.PodSpec{
330335
RestartPolicy: corev1.RestartPolicyNever,
331336
ServiceAccountName: "parser",
@@ -439,6 +444,13 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
439444
Spec: *scanType.Spec.JobTemplate.Spec.DeepCopy(),
440445
}
441446

447+
podAnnotations := scanType.Spec.JobTemplate.DeepCopy().Annotations
448+
if podAnnotations == nil {
449+
podAnnotations = make(map[string]string)
450+
}
451+
podAnnotations["experimental.securecodebox.io/job-type"] = "scanner"
452+
job.Spec.Template.Annotations = podAnnotations
453+
442454
job.Spec.Template.Spec.ServiceAccountName = "lurcher"
443455

444456
// merging volume definition from ScanType (if existing) with standard results volume
@@ -631,6 +643,11 @@ func (r *ScanReconciler) startPersistenceProvider(scan *executionv1.Scan) error
631643
},
632644
Spec: batch.JobSpec{
633645
Template: corev1.PodTemplateSpec{
646+
ObjectMeta: metav1.ObjectMeta{
647+
Annotations: map[string]string{
648+
"auto-discovery.experimental.securecodebox.io/ignore": "true",
649+
},
650+
},
634651
Spec: corev1.PodSpec{
635652
ServiceAccountName: "persistence",
636653
RestartPolicy: corev1.RestartPolicyNever,

0 commit comments

Comments
 (0)