Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions api/v1/webspherelibertyapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,25 @@ func (cr *WebSphereLibertyApplication) GetManageTLS() *bool {
return cr.Spec.ManageTLS
}

// GetManagedPort returns the application's CR managed port
func (cr *WebSphereLibertyApplication) GetManagedPort() int {
if cr.GetService() != nil && cr.GetService().GetPort() != 0 {
return int(cr.GetService().GetPort())
}
if cr.GetManageTLS() == nil || *cr.GetManageTLS() {
return 9443
}
return 9080
}

// GetManagedScheme returns the application's CR managed scheme
func (cr *WebSphereLibertyApplication) GetManagedScheme() corev1.URIScheme {
if cr.GetManageTLS() == nil || *cr.GetManageTLS() {
return corev1.URISchemeHTTPS
}
return corev1.URISchemeHTTP
}

// GetEnv returns slice of environment variables
func (cr *WebSphereLibertyApplication) GetEnv() []corev1.EnvVar {
return cr.Spec.Env
Expand Down Expand Up @@ -1452,12 +1471,7 @@ func (cr *WebSphereLibertyApplication) Initialize() {
}

if cr.Spec.Service.Port == 0 {
if cr.Spec.ManageTLS == nil || *cr.Spec.ManageTLS {
cr.Spec.Service.Port = 9443

} else {
cr.Spec.Service.Port = 9080
}
cr.Spec.Service.Port = int32(cr.GetManagedPort())
}

// If TargetPorts on Serviceports are not set, default them to the Port value in the CR
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/WASdev/websphere-liberty-operator
go 1.25

require (
github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251124214343-4fee1b0d8d1e
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251120112423-05f65c81aa36
github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20260106154422-7a3d19a805da
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20260106154102-e673c1d851ac
github.com/cert-manager/cert-manager v1.16.5
github.com/go-logr/logr v1.4.3
github.com/openshift/api v0.0.0-20250710004639-926605d3338b
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251124214343-4fee1b0d8d1e h1:7pCncY3KcsAge1E1E9tYo1ZM2bcfsg7dJ4XLKraVmkI=
github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20251124214343-4fee1b0d8d1e/go.mod h1:ghwA2Fvfq6YphR93lp8vKEJ7mLYT1+sEvI6re16Kn0c=
github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20260106154422-7a3d19a805da h1:ooXuTyefwe1YnfV4hUxTWlAIi6vKHy7YZKSAGOGjiww=
github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20260106154422-7a3d19a805da/go.mod h1:qEW+woqfHEZDWbpEbH0T3FFZn5vh9cRkEI5eBnIrJo4=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251120112423-05f65c81aa36 h1:fweyU4TX3vSrbWecLy6FYjIgnoybPdoJbOiZsoV+iDw=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20251120112423-05f65c81aa36/go.mod h1:Hs5AbE9J+rLM34IAc75X7dtxnrzFg2AvG1XYLcX/ApU=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20260106154102-e673c1d851ac h1:kFJbKPEr/mxg5jtA6eEKYA54DXVKDwErINQ4P3zz4kE=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20260106154102-e673c1d851ac/go.mod h1:pmfannSJv1Tby0uSPXLPg3A+mC1WahsMJTNa2oU3SHk=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down
26 changes: 13 additions & 13 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (

"math/rand/v2"

"github.com/application-stacks/runtime-component-operator/common"

wlv1 "github.com/WASdev/websphere-liberty-operator/api/v1"
rcoutils "github.com/application-stacks/runtime-component-operator/utils"
routev1 "github.com/openshift/api/route/v1"
Expand Down Expand Up @@ -109,9 +111,6 @@ var entitlementCloudPakID = map[wlv1.LicenseEntitlement]string{
const StartupProbeFileBasedScriptName = "startupHealthCheck.sh"
const LivenessProbeFileBasedScriptName = "livenessHealthCheck.sh"
const ReadinessProbeFileBasedScriptName = "readinessHealthCheck.sh"
const StartupProbeFileName = "started"
const LivenessProbeFileName = "live"
const ReadinessProbeFileName = "ready"

type LTPAMetadata struct {
Kind string
Expand Down Expand Up @@ -1113,7 +1112,7 @@ func clearFileBasedProbe(probe *corev1.Probe) *corev1.Probe {
return probe
}

func configureFileBasedProbeExec(probe *corev1.Probe, scriptName string, probeFile string) {
func configureFileBasedProbeExec(probe *corev1.Probe, scriptName string) {
probe = getProbeWithoutHandlers(probe) // remove any preset handlers configured to this probe
cmdList := []string{scriptName}
if scriptName == StartupProbeFileBasedScriptName {
Expand Down Expand Up @@ -1149,13 +1148,13 @@ func getOrInitProbe(probe *corev1.Probe) *corev1.Probe {
return probe
}

func patchFileBasedProbe(defaultProbe *corev1.Probe, instanceProbe *corev1.Probe, scriptName string, probeFile string) *corev1.Probe {
func patchFileBasedProbe(defaultProbe *corev1.Probe, instanceProbe *corev1.Probe, scriptName string) *corev1.Probe {
defaultProbe = getOrInitProbe(defaultProbe)
instanceProbe = getOrInitProbe(instanceProbe)
isExecConfigured := instanceProbe.Exec != nil // this flag allows the user to override the ExecAction object to bring their own custom file-based health check
instanceProbe = rcoutils.CustomizeProbeDefaults(instanceProbe, defaultProbe)
instanceProbe = common.CustomizeProbeDefaults(instanceProbe, defaultProbe)
if !isExecConfigured {
configureFileBasedProbeExec(instanceProbe, scriptName, probeFile)
configureFileBasedProbeExec(instanceProbe, scriptName)
}
return instanceProbe
}
Expand Down Expand Up @@ -1186,14 +1185,15 @@ func customizeFileBasedProbes(appContainer *corev1.Container, instance *wlv1.Web
if appContainer == nil {
return
}
if instance.Spec.Probes.WebSphereLibertyApplicationProbes.Startup != nil {
appContainer.StartupProbe = patchFileBasedProbe(instance.Spec.Probes.WebSphereLibertyApplicationProbes.GetDefaultStartupProbe(instance), instance.Spec.Probes.Startup, StartupProbeFileBasedScriptName, StartupProbeFileName)
probes := instance.Spec.Probes.WebSphereLibertyApplicationProbes
if probes.Startup != nil {
appContainer.StartupProbe = patchFileBasedProbe(probes.GetDefaultStartupProbe(instance), probes.GetStartupProbe(), StartupProbeFileBasedScriptName)
}
if instance.Spec.Probes.WebSphereLibertyApplicationProbes.Liveness != nil {
appContainer.LivenessProbe = patchFileBasedProbe(instance.Spec.Probes.WebSphereLibertyApplicationProbes.GetDefaultLivenessProbe(instance), instance.Spec.Probes.Liveness, LivenessProbeFileBasedScriptName, LivenessProbeFileName)
if probes.Liveness != nil {
appContainer.LivenessProbe = patchFileBasedProbe(probes.GetDefaultLivenessProbe(instance), probes.GetLivenessProbe(), LivenessProbeFileBasedScriptName)
}
if instance.Spec.Probes.WebSphereLibertyApplicationProbes.Readiness != nil {
appContainer.ReadinessProbe = patchFileBasedProbe(instance.Spec.Probes.WebSphereLibertyApplicationProbes.GetDefaultReadinessProbe(instance), instance.Spec.Probes.Readiness, ReadinessProbeFileBasedScriptName, ReadinessProbeFileName)
if probes.Readiness != nil {
appContainer.ReadinessProbe = patchFileBasedProbe(probes.GetDefaultReadinessProbe(instance), probes.GetReadinessProbe(), ReadinessProbeFileBasedScriptName)
}
}

Expand Down