Skip to content

Conversation

@kabicin
Copy link
Collaborator

@kabicin kabicin commented Nov 25, 2025

What this PR does / why we need it?:

  • The port/scheme will default based upon the CR instance's .spec.manageTLS value. For example, if manageTLS is true or undefined, scheme will be HTTPS and otherwise, HTTP.

Does this PR introduce a user-facing change?

  • User guide
  • CHANGELOG.md

Which issue(s) this PR fixes:

Fixes #

}

func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme {
if cr.GetManageTLS() != nil && *cr.GetManageTLS() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle the default value of manageTLS (when nil)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added check for when GetManageTLS() == nil

}

func (cr *RuntimeComponent) GetManagedPort() int {
return int(cr.GetService().GetPort())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate that the default value Operator sets (when user hasn't configured Service port) is retrieved here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added nil check on GetService() and fallback to 8080

Copy link
Member

@leochr leochr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kabicin Thank you for the updates. Added some comments and a clarification.

common/types.go Outdated

// This struct is taken from the Probe specification in https://github.com/kubernetes/api/blob/v0.33.4/core/v1/types.go
// +kubebuilder:object:generate=true
type BaseComponentProbe struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the structs

common/common.go Outdated
if probe.ProbeHandler.HTTPGet == nil {
probe.ProbeHandler.HTTPGet = &corev1.HTTPGetAction{}
}
if config.ProbeHandler.HTTPGet.Port.Type != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to confirm that a nil check on config.ProbeHandler.HTTPGet.Port is not needed here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it is not needed, it is an artifact from prior utils_test.go changes.

common/common.go Outdated
Port: intstr.FromInt(int(ba.GetService().GetPort())),
Scheme: "HTTPS",
Port: intstr.FromInt(ba.GetManagedPort()),
Scheme: corev1.URISchemeHTTPS,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the Service port is 9080 then we should use HTTP scheme instead, so that users wouldn't have to add config just to specify the HTTP scheme.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, some tests assume scheme is not affected by .spec.manageTLS so there may be some breaking changes. For example, some probes tests need adjustment after this change. Please see adjustments at https://github.ibm.com/websphere/operators/pull/258/files#diff-d8a058f0da1d4a6c12d831cf53afe614d6e03adecc6b633a4a387d4294f239e2 for added context.

@kabicin kabicin changed the title Add OptionalHTTPGetAction to the CR probes config Add probes port and scheme based on .spec.manageTLS Nov 28, 2025
@kabicin kabicin changed the title Add probes port and scheme based on .spec.manageTLS Set probes port and scheme based on .spec.manageTLS Nov 28, 2025
Copy link
Member

@leochr leochr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kabicin Looks good. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants