@@ -309,15 +309,18 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
309309 rules ,
310310 )
311311
312+ labels := scan .ObjectMeta .DeepCopy ().Labels
313+ if labels == nil {
314+ labels = make (map [string ]string )
315+ }
316+ labels ["experimental.securecodebox.io/job-type" ] = "parser"
312317 automountServiceAccountToken := true
313318 job = & batch.Job {
314319 ObjectMeta : metav1.ObjectMeta {
315320 Annotations : make (map [string ]string ),
316321 Name : fmt .Sprintf ("parse-%s" , scan .Name ),
317322 Namespace : scan .Namespace ,
318- Labels : map [string ]string {
319- "experimental.securecodebox.io/job-type" : "parser" ,
320- },
323+ Labels : labels ,
321324 },
322325 Spec : batch.JobSpec {
323326 Template : corev1.PodTemplateSpec {
@@ -420,14 +423,16 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
420423 return nil , errors .New ("ScanType must at least contain one container in which the scanner is running" )
421424 }
422425
426+ labels := scan .ObjectMeta .DeepCopy ().Labels
427+ if labels == nil {
428+ labels = make (map [string ]string )
429+ }
430+ labels ["experimental.securecodebox.io/job-type" ] = "scanner"
423431 job := & batch.Job {
424432 ObjectMeta : metav1.ObjectMeta {
425- Labels : map [string ]string {
426- "experimental.securecodebox.io/job-type" : "scanner" ,
427- },
428- Annotations : make (map [string ]string ),
429- Name : fmt .Sprintf ("scan-%s" , scan .Name ),
430- Namespace : scan .Namespace ,
433+ Labels : labels ,
434+ Name : fmt .Sprintf ("scan-%s" , scan .Name ),
435+ Namespace : scan .Namespace ,
431436 },
432437 Spec : * scanType .Spec .JobTemplate .Spec .DeepCopy (),
433438 }
@@ -610,14 +615,17 @@ func (r *ScanReconciler) startPersistenceProvider(scan *executionv1.Scan) error
610615 },
611616 }
612617
618+ labels := scan .ObjectMeta .DeepCopy ().Labels
619+ if labels == nil {
620+ labels = make (map [string ]string )
621+ }
622+ labels ["experimental.securecodebox.io/job-type" ] = "persistence"
613623 job := & batch.Job {
614624 ObjectMeta : metav1.ObjectMeta {
615625 Annotations : make (map [string ]string ),
616- Name : fmt .Sprintf ("persist -%s" , scan .Name ),
626+ Name : fmt .Sprintf ("%s -%s" , persistenceProvider . Name , scan .Name ),
617627 Namespace : scan .Namespace ,
618- Labels : map [string ]string {
619- "experimental.securecodebox.io/job-type" : "persistence" ,
620- },
628+ Labels : labels ,
621629 },
622630 Spec : batch.JobSpec {
623631 Template : corev1.PodTemplateSpec {
0 commit comments