@@ -46,6 +46,7 @@ const (
4646 SemeruGenerationLabelNameSuffix = "/semeru-compiler-generation"
4747 StatusReferenceSemeruGeneration = "semeruGeneration"
4848 StatusReferenceSemeruInstancesCompleted = "semeruInstancesCompleted"
49+ SemeruContainerName = "compiler"
4950)
5051
5152func getCompilerMeta (wlva * wlv1.WebSphereLibertyApplication ) metav1.ObjectMeta {
@@ -55,6 +56,15 @@ func getCompilerMeta(wlva *wlv1.WebSphereLibertyApplication) metav1.ObjectMeta {
5556 }
5657}
5758
59+ func getSemeruDeploymentContainer (deploy * appsv1.Deployment ) (corev1.Container , error ) {
60+ for _ , container := range deploy .Spec .Template .Spec .Containers {
61+ if container .Name == SemeruContainerName {
62+ return container , nil
63+ }
64+ }
65+ return corev1.Container {}, fmt .Errorf ("could not find the Semeru Deployment container" )
66+ }
67+
5868// Returns true if the semeru health port configuration has changed otherwise false
5969func (r * ReconcileWebSphereLiberty ) upgradeSemeruHealthPorts (inputMeta metav1.ObjectMeta , wlva * wlv1.WebSphereLibertyApplication ) bool {
6070 var healthPort int32 = 38600
@@ -63,15 +73,17 @@ func (r *ReconcileWebSphereLiberty) upgradeSemeruHealthPorts(inputMeta metav1.Ob
6373 }
6474 semeruDeployment := & appsv1.Deployment {ObjectMeta : inputMeta }
6575 if r .GetClient ().Get (context .TODO (), types.NamespacedName {Name : semeruDeployment .Name , Namespace : semeruDeployment .Namespace }, semeruDeployment ) == nil {
76+ container , err := getSemeruDeploymentContainer (semeruDeployment )
77+ if err != nil {
78+ return false
79+ }
80+ if healthPort == 38400 && len (container .Ports ) > 1 {
81+ return true
82+ }
6683 containsHealthPort := false
67- for _ , container := range semeruDeployment .Spec .Template .Spec .Containers {
68- for _ , port := range container .Ports {
69- if port .ContainerPort == healthPort {
70- containsHealthPort = true
71- }
72- }
73- if containsHealthPort {
74- break
84+ for _ , port := range container .Ports {
85+ if port .ContainerPort == healthPort {
86+ containsHealthPort = true
7587 }
7688 }
7789 if ! containsHealthPort {
@@ -399,7 +411,7 @@ func (r *ReconcileWebSphereLiberty) reconcileSemeruDeployment(wlva *wlv1.WebSphe
399411 },
400412 Containers : []corev1.Container {
401413 {
402- Name : "compiler" ,
414+ Name : SemeruContainerName ,
403415 Image : wlva .Status .GetImageReference (),
404416 ImagePullPolicy : * wlva .GetPullPolicy (),
405417 Command : []string {"jitserver" },
0 commit comments