@@ -81,7 +81,7 @@ func (r *GatlingReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
81
81
log .Info ("Reconciling Gatling" )
82
82
// r.dumpGatlingStatus(gatling, log)
83
83
if r .isGatlingCompleted (gatling ) {
84
- log .Info ("Gatling job has completed!" , "name" , gatling . ObjectMeta . Name , "namespace" , gatling . ObjectMeta .Namespace )
84
+ log .Info ("Gatling job has completed!" , "name" , r . getObjectMeta ( gatling ). Name , "namespace" , r . getObjectMeta ( gatling ) .Namespace )
85
85
86
86
// Clean up Job resources if neccessary
87
87
if gatling .Spec .CleanupAfterJobDone {
@@ -458,6 +458,11 @@ func (r *GatlingReconciler) newGatlingRunnerJobForCR(gatling *gatlingv1alpha1.Ga
458
458
Parallelism : r .getGatlingRunnerJobParallelism (gatling ),
459
459
Completions : r .getGatlingRunnerJobParallelism (gatling ),
460
460
Template : corev1.PodTemplateSpec {
461
+ ObjectMeta : metav1.ObjectMeta {
462
+ Name : r .getObjectMeta (gatling ).Name ,
463
+ Labels : utils .AddMapValue ("type" , "runner" , r .getObjectMeta (gatling ).Labels , true ),
464
+ Annotations : r .getObjectMeta (gatling ).Annotations ,
465
+ },
461
466
Spec : corev1.PodSpec {
462
467
Affinity : r .getPodAffinity (gatling ),
463
468
Tolerations : r .getPodTolerations (gatling ),
@@ -519,6 +524,11 @@ func (r *GatlingReconciler) newGatlingRunnerJobForCR(gatling *gatlingv1alpha1.Ga
519
524
Parallelism : & gatling .Spec .TestScenarioSpec .Parallelism ,
520
525
Completions : & gatling .Spec .TestScenarioSpec .Parallelism ,
521
526
Template : corev1.PodTemplateSpec {
527
+ ObjectMeta : metav1.ObjectMeta {
528
+ Name : r .getObjectMeta (gatling ).Name ,
529
+ Labels : utils .AddMapValue ("type" , "runner" , r .getObjectMeta (gatling ).Labels , true ),
530
+ Annotations : r .getObjectMeta (gatling ).Annotations ,
531
+ },
522
532
Spec : corev1.PodSpec {
523
533
Affinity : r .getPodAffinity (gatling ),
524
534
Tolerations : r .getPodTolerations (gatling ),
@@ -588,6 +598,11 @@ func (r *GatlingReconciler) newGatlingReporterJobForCR(gatling *gatlingv1alpha1.
588
598
},
589
599
Spec : batchv1.JobSpec {
590
600
Template : corev1.PodTemplateSpec {
601
+ ObjectMeta : metav1.ObjectMeta {
602
+ Name : r .getObjectMeta (gatling ).Name ,
603
+ Labels : utils .AddMapValue ("type" , "reporter" , r .getObjectMeta (gatling ).Labels , true ),
604
+ Annotations : r .getObjectMeta (gatling ).Annotations ,
605
+ },
591
606
Spec : corev1.PodSpec {
592
607
Affinity : r .getPodAffinity (gatling ),
593
608
Tolerations : r .getPodTolerations (gatling ),
@@ -922,6 +937,14 @@ func (r *GatlingReconciler) getPodResources(gatling *gatlingv1alpha1.Gatling) co
922
937
return resources
923
938
}
924
939
940
+ func (r * GatlingReconciler ) getObjectMeta (gatling * gatlingv1alpha1.Gatling ) * metav1.ObjectMeta {
941
+ objectmeta := metav1.ObjectMeta {}
942
+ if & gatling != nil && & gatling .ObjectMeta != nil {
943
+ objectmeta = gatling .ObjectMeta
944
+ }
945
+ return & objectmeta
946
+ }
947
+
925
948
func (r * GatlingReconciler ) getPodAffinity (gatling * gatlingv1alpha1.Gatling ) * corev1.Affinity {
926
949
affinity := corev1.Affinity {}
927
950
if & gatling .Spec .PodSpec != nil && & gatling .Spec .PodSpec .Affinity != nil {
0 commit comments