-
Notifications
You must be signed in to change notification settings - Fork 24
Set probes port and scheme based on .spec.manageTLS #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
api/v1/runtimecomponent_types.go
Outdated
| } | ||
|
|
||
| func (cr *RuntimeComponent) GetManagedScheme() corev1.URIScheme { | ||
| if cr.GetManageTLS() != nil && *cr.GetManageTLS() { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
api/v1/runtimecomponent_types.go
Outdated
| } | ||
|
|
||
| func (cr *RuntimeComponent) GetManagedPort() int { | ||
| return int(cr.GetService().GetPort()) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
leochr
left a comment
There was a problem hiding this 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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
leochr
left a comment
There was a problem hiding this 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.
What this PR does / why we need it?:
.spec.manageTLSvalue. For example, if manageTLS is true or undefined, scheme will be HTTPS and otherwise, HTTP.Does this PR introduce a user-facing change?
CHANGELOG.mdWhich issue(s) this PR fixes:
Fixes #