Skip to content

Commit c20ce79

Browse files
committed
Add semeru health port config
1 parent d0fa452 commit c20ce79

File tree

8 files changed

+111
-71
lines changed

8 files changed

+111
-71
lines changed

api/v1/webspherelibertyapplication_types.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,14 @@ type WebSphereLibertyApplicationSemeruCloudCompiler struct {
520520
// Resource requests and limits for the Semeru Cloud Compiler. The CPU defaults to 100m with a limit of 2000m. The memory defaults to 800Mi, with a limit of 1200Mi.
521521
// +operator-sdk:csv:customresourcedefinitions:order=54,type=spec,displayName="Resource Requirements",xDescriptors="urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
522522
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
523+
// The health settings for the Semeru Cloud Compiler.
524+
// +operator-sdk:csv:customresourcedefinitions:order=55,type=spec,displayName="Health"
525+
Health *WebSphereLibertyApplicationSemeruCloudCompilerHealth `json:"health,omitempty"`
526+
}
527+
528+
type WebSphereLibertyApplicationSemeruCloudCompilerHealth struct {
523529
// The health port for the Semeru Cloud Compiler. Defaults to 38600.
524-
// +operator-sdk:csv:customresourcedefinitions:order=55,type=spec,displayName="Port",xDescriptors="urn:alm:descriptor:com.tectonic.ui:number"
530+
// +operator-sdk:csv:customresourcedefinitions:order=60,type=spec,displayName="Port",xDescriptors="urn:alm:descriptor:com.tectonic.ui:number"
525531
Port *int32 `json:"port,omitempty"`
526532
}
527533

@@ -1290,9 +1296,14 @@ func (scc *WebSphereLibertyApplicationSemeruCloudCompiler) GetReplicas() *int32
12901296
return &one
12911297
}
12921298

1293-
func (scc *WebSphereLibertyApplicationSemeruCloudCompiler) GetPort() *int32 {
1294-
if scc.Port != nil {
1295-
return scc.Port
1299+
// GetHealth returns the Semeru Cloud Compiler Health configuration
1300+
func (scc *WebSphereLibertyApplicationSemeruCloudCompiler) GetHealth() *WebSphereLibertyApplicationSemeruCloudCompilerHealth {
1301+
return scc.Health
1302+
}
1303+
1304+
func (scch *WebSphereLibertyApplicationSemeruCloudCompilerHealth) GetPort() *int32 {
1305+
if scch.Port != nil {
1306+
return scch.Port
12961307
}
12971308
defaultPort := int32(38600)
12981309
return &defaultPort

bundle/manifests/ibm-websphere-liberty.clusterserviceversion.yaml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -538,48 +538,51 @@ spec:
538538
be removed from service endpoints if the probe fails.
539539
displayName: Readiness Probe
540540
path: probes.readiness
541+
- description: Enable the Semeru Cloud Compiler. Defaults to false.
542+
displayName: Enable
543+
path: semeruCloudCompiler.enable
544+
x-descriptors:
545+
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
541546
- description: Probe to determine successful initialization. If specified, other
542547
probes are not executed until this completes successfully.
543548
displayName: Startup Probe
544549
path: probes.startup
550+
- description: Number of desired pods for the Semeru Cloud Compiler. Defaults
551+
to 1.
552+
displayName: Replicas
553+
path: semeruCloudCompiler.replicas
554+
x-descriptors:
555+
- urn:alm:descriptor:com.tectonic.ui:podCount
545556
- description: Disable the creation of the network policy. Defaults to false.
546557
displayName: Disable
547558
path: networkPolicy.disable
548559
x-descriptors:
549560
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
550-
- description: Enable the Semeru Cloud Compiler. Defaults to false.
551-
displayName: Enable
552-
path: semeruCloudCompiler.enable
561+
- description: Resource requests and limits for the Semeru Cloud Compiler. The
562+
CPU defaults to 100m with a limit of 2000m. The memory defaults to 800Mi,
563+
with a limit of 1200Mi.
564+
displayName: Resource Requirements
565+
path: semeruCloudCompiler.resources
553566
x-descriptors:
554-
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
567+
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
555568
- description: Specify the labels of namespaces that incoming traffic is allowed
556569
from.
557570
displayName: Namespace Labels
558571
path: networkPolicy.namespaceLabels
559572
x-descriptors:
560573
- urn:alm:descriptor:com.tectonic.ui:text
561-
- description: Number of desired pods for the Semeru Cloud Compiler. Defaults
562-
to 1.
563-
displayName: Replicas
564-
path: semeruCloudCompiler.replicas
565-
x-descriptors:
566-
- urn:alm:descriptor:com.tectonic.ui:podCount
574+
- description: The health settings for the Semeru Cloud Compiler.
575+
displayName: Health
576+
path: semeruCloudCompiler.health
567577
- description: Specify the labels of pod(s) that incoming traffic is allowed
568578
from.
569579
displayName: From Labels
570580
path: networkPolicy.fromLabels
571581
x-descriptors:
572582
- urn:alm:descriptor:com.tectonic.ui:text
573-
- description: Resource requests and limits for the Semeru Cloud Compiler. The
574-
CPU defaults to 100m with a limit of 2000m. The memory defaults to 800Mi,
575-
with a limit of 1200Mi.
576-
displayName: Resource Requirements
577-
path: semeruCloudCompiler.resources
578-
x-descriptors:
579-
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
580583
- description: The health port for the Semeru Cloud Compiler. Defaults to 38600.
581584
displayName: Port
582-
path: semeruCloudCompiler.port
585+
path: semeruCloudCompiler.health.port
583586
x-descriptors:
584587
- urn:alm:descriptor:com.tectonic.ui:number
585588
- description: 'Product edition. Defaults to IBM WebSphere Application Server.

bundle/manifests/liberty.websphere.ibm.com_webspherelibertyapplications.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4173,11 +4173,15 @@ spec:
41734173
enable:
41744174
description: Enable the Semeru Cloud Compiler. Defaults to false.
41754175
type: boolean
4176-
port:
4177-
description: The health port for the Semeru Cloud Compiler. Defaults
4178-
to 38600.
4179-
format: int32
4180-
type: integer
4176+
health:
4177+
description: The health settings for the Semeru Cloud Compiler.
4178+
properties:
4179+
port:
4180+
description: The health port for the Semeru Cloud Compiler.
4181+
Defaults to 38600.
4182+
format: int32
4183+
type: integer
4184+
type: object
41814185
replicas:
41824186
description: Number of desired pods for the Semeru Cloud Compiler.
41834187
Defaults to 1.

config/crd/bases/liberty.websphere.ibm.com_webspherelibertyapplications.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4169,11 +4169,15 @@ spec:
41694169
enable:
41704170
description: Enable the Semeru Cloud Compiler. Defaults to false.
41714171
type: boolean
4172-
port:
4173-
description: The health port for the Semeru Cloud Compiler. Defaults
4174-
to 38600.
4175-
format: int32
4176-
type: integer
4172+
health:
4173+
description: The health settings for the Semeru Cloud Compiler.
4174+
properties:
4175+
port:
4176+
description: The health port for the Semeru Cloud Compiler.
4177+
Defaults to 38600.
4178+
format: int32
4179+
type: integer
4180+
type: object
41774181
replicas:
41784182
description: Number of desired pods for the Semeru Cloud Compiler.
41794183
Defaults to 1.

config/manifests/bases/ibm-websphere-liberty.clusterserviceversion.yaml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -480,48 +480,51 @@ spec:
480480
be removed from service endpoints if the probe fails.
481481
displayName: Readiness Probe
482482
path: probes.readiness
483+
- description: Enable the Semeru Cloud Compiler. Defaults to false.
484+
displayName: Enable
485+
path: semeruCloudCompiler.enable
486+
x-descriptors:
487+
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
483488
- description: Probe to determine successful initialization. If specified, other
484489
probes are not executed until this completes successfully.
485490
displayName: Startup Probe
486491
path: probes.startup
492+
- description: Number of desired pods for the Semeru Cloud Compiler. Defaults
493+
to 1.
494+
displayName: Replicas
495+
path: semeruCloudCompiler.replicas
496+
x-descriptors:
497+
- urn:alm:descriptor:com.tectonic.ui:podCount
487498
- description: Disable the creation of the network policy. Defaults to false.
488499
displayName: Disable
489500
path: networkPolicy.disable
490501
x-descriptors:
491502
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
492-
- description: Enable the Semeru Cloud Compiler. Defaults to false.
493-
displayName: Enable
494-
path: semeruCloudCompiler.enable
503+
- description: Resource requests and limits for the Semeru Cloud Compiler. The
504+
CPU defaults to 100m with a limit of 2000m. The memory defaults to 800Mi,
505+
with a limit of 1200Mi.
506+
displayName: Resource Requirements
507+
path: semeruCloudCompiler.resources
495508
x-descriptors:
496-
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
509+
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
497510
- description: Specify the labels of namespaces that incoming traffic is allowed
498511
from.
499512
displayName: Namespace Labels
500513
path: networkPolicy.namespaceLabels
501514
x-descriptors:
502515
- urn:alm:descriptor:com.tectonic.ui:text
503-
- description: Number of desired pods for the Semeru Cloud Compiler. Defaults
504-
to 1.
505-
displayName: Replicas
506-
path: semeruCloudCompiler.replicas
507-
x-descriptors:
508-
- urn:alm:descriptor:com.tectonic.ui:podCount
516+
- description: The health settings for the Semeru Cloud Compiler.
517+
displayName: Health
518+
path: semeruCloudCompiler.health
509519
- description: Specify the labels of pod(s) that incoming traffic is allowed
510520
from.
511521
displayName: From Labels
512522
path: networkPolicy.fromLabels
513523
x-descriptors:
514524
- urn:alm:descriptor:com.tectonic.ui:text
515-
- description: Resource requests and limits for the Semeru Cloud Compiler. The
516-
CPU defaults to 100m with a limit of 2000m. The memory defaults to 800Mi,
517-
with a limit of 1200Mi.
518-
displayName: Resource Requirements
519-
path: semeruCloudCompiler.resources
520-
x-descriptors:
521-
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
522525
- description: The health port for the Semeru Cloud Compiler. Defaults to 38600.
523526
displayName: Port
524-
path: semeruCloudCompiler.port
527+
path: semeruCloudCompiler.health.port
525528
x-descriptors:
526529
- urn:alm:descriptor:com.tectonic.ui:number
527530
- description: 'Product edition. Defaults to IBM WebSphere Application Server.

internal/controller/semeru_compiler.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ func (r *ReconcileWebSphereLiberty) deleteCompletedSemeruInstances(wlva *wlv1.We
256256

257257
func (r *ReconcileWebSphereLiberty) reconcileSemeruDeployment(wlva *wlv1.WebSphereLibertyApplication, deploy *appsv1.Deployment) {
258258
var port int32 = 38400
259+
var healthPort int32 = 38600
259260
deploy.Labels = getLabels(wlva)
260261
deploy.Spec.Strategy.Type = appsv1.RecreateDeploymentStrategyType
261262

@@ -277,9 +278,11 @@ func (r *ReconcileWebSphereLiberty) reconcileSemeruDeployment(wlva *wlv1.WebSphe
277278
limitsMemory := getQuantityFromLimitsOrDefault(instanceResources, corev1.ResourceMemory, "1200Mi")
278279
limitsCPU := getQuantityFromLimitsOrDefault(instanceResources, corev1.ResourceCPU, "2000m")
279280

280-
portNumber := *semeruCloudCompiler.GetPort()
281+
if semeruCloudCompiler.GetHealth() != nil {
282+
healthPort = *semeruCloudCompiler.GetHealth().GetPort()
283+
}
281284
var portIntOrStr intstr.IntOrString
282-
if portNumber == port {
285+
if healthPort == port {
283286
portIntOrStr = intstr.FromInt32(port)
284287
} else {
285288
portIntOrStr = intstr.FromString(fmt.Sprintf("%d-tcp", port))
@@ -316,12 +319,12 @@ func (r *ReconcileWebSphereLiberty) reconcileSemeruDeployment(wlva *wlv1.WebSphe
316319
})
317320

318321
healthProbesFlag := ""
319-
if portNumber != port {
320-
healthProbesFlag = " -XX:+JITServerHealthProbes" + fmt.Sprintf(" -XX:JITServerHealthProbePort=%d", portNumber)
322+
if healthPort != port {
323+
healthProbesFlag = " -XX:+JITServerHealthProbes" + fmt.Sprintf(" -XX:JITServerHealthProbePort=%d", healthPort)
321324
containerPorts[0].Name = fmt.Sprintf("%d-tcp", port)
322325
containerPorts = append(containerPorts, corev1.ContainerPort{
323-
Name: fmt.Sprintf("%d-tcp", portNumber),
324-
ContainerPort: portNumber,
326+
Name: fmt.Sprintf("%d-tcp", healthPort),
327+
ContainerPort: healthPort,
325328
Protocol: corev1.ProtocolTCP,
326329
})
327330
}
@@ -433,6 +436,7 @@ func (r *ReconcileWebSphereLiberty) reconcileSemeruDeployment(wlva *wlv1.WebSphe
433436

434437
func reconcileSemeruService(svc *corev1.Service, wlva *wlv1.WebSphereLibertyApplication) {
435438
var port int32 = 38400
439+
var healthPort int32 = 38600
436440
var timeout int32 = 86400
437441
svc.Labels = getLabels(wlva)
438442
svc.Spec.Selector = getSelectors(wlva)
@@ -441,21 +445,24 @@ func reconcileSemeruService(svc *corev1.Service, wlva *wlv1.WebSphereLibertyAppl
441445
if numPorts == 0 {
442446
svc.Spec.Ports = append(svc.Spec.Ports, corev1.ServicePort{})
443447
}
448+
444449
svc.Spec.Ports[0].Protocol = corev1.ProtocolTCP
445450
svc.Spec.Ports[0].Port = port
446451
svc.Spec.Ports[0].TargetPort = intstr.FromInt(int(port))
447-
portNumber := *wlva.GetSemeruCloudCompiler().GetPort()
448-
if portNumber != port {
452+
if wlva.GetSemeruCloudCompiler().GetHealth() != nil {
453+
healthPort = *wlva.GetSemeruCloudCompiler().GetHealth().GetPort()
454+
}
455+
if healthPort != port {
449456
numPorts = len(svc.Spec.Ports)
450457
if numPorts == 1 {
451458
svc.Spec.Ports = append(svc.Spec.Ports, corev1.ServicePort{})
452459
}
453460
svc.Spec.Ports[0].Name = fmt.Sprintf("%d-tcp", port)
454461
svc.Spec.Ports[0].TargetPort = intstr.FromString(fmt.Sprintf("%d-tcp", port))
455-
svc.Spec.Ports[1].Name = fmt.Sprintf("%d-tcp", portNumber)
462+
svc.Spec.Ports[1].Name = fmt.Sprintf("%d-tcp", healthPort)
456463
svc.Spec.Ports[1].Protocol = corev1.ProtocolTCP
457-
svc.Spec.Ports[1].Port = portNumber
458-
svc.Spec.Ports[1].TargetPort = intstr.FromString(fmt.Sprintf("%d-tcp", portNumber))
464+
svc.Spec.Ports[1].Port = healthPort
465+
svc.Spec.Ports[1].TargetPort = intstr.FromString(fmt.Sprintf("%d-tcp", healthPort))
459466
}
460467
svc.Spec.SessionAffinity = corev1.ServiceAffinityClientIP
461468
svc.Spec.SessionAffinityConfig = &corev1.SessionAffinityConfig{

internal/deploy/kubectl/websphereliberty-app-crd.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4172,11 +4172,15 @@ spec:
41724172
enable:
41734173
description: Enable the Semeru Cloud Compiler. Defaults to false.
41744174
type: boolean
4175-
port:
4176-
description: The health port for the Semeru Cloud Compiler. Defaults
4177-
to 38600.
4178-
format: int32
4179-
type: integer
4175+
health:
4176+
description: The health settings for the Semeru Cloud Compiler.
4177+
properties:
4178+
port:
4179+
description: The health port for the Semeru Cloud Compiler.
4180+
Defaults to 38600.
4181+
format: int32
4182+
type: integer
4183+
type: object
41804184
replicas:
41814185
description: Number of desired pods for the Semeru Cloud Compiler.
41824186
Defaults to 1.

internal/deploy/kustomize/daily/base/websphere-liberty-crd.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4172,11 +4172,15 @@ spec:
41724172
enable:
41734173
description: Enable the Semeru Cloud Compiler. Defaults to false.
41744174
type: boolean
4175-
port:
4176-
description: The health port for the Semeru Cloud Compiler. Defaults
4177-
to 38600.
4178-
format: int32
4179-
type: integer
4175+
health:
4176+
description: The health settings for the Semeru Cloud Compiler.
4177+
properties:
4178+
port:
4179+
description: The health port for the Semeru Cloud Compiler.
4180+
Defaults to 38600.
4181+
format: int32
4182+
type: integer
4183+
type: object
41804184
replicas:
41814185
description: Number of desired pods for the Semeru Cloud Compiler.
41824186
Defaults to 1.

0 commit comments

Comments
 (0)