COO-1749: ObservabilityInstaller: do not require TLS spec for https#1045
COO-1749: ObservabilityInstaller: do not require TLS spec for https#1045pavolloffay wants to merge 1 commit intorhobs:mainfrom
Conversation
|
@pavolloffay: This pull request references COO-1749 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.22.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pavolloffay The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTempo TLS enablement in the controller was modified: TLS is now activated when an explicit TLS block is present or when the S3 object storage endpoint URL begins with "https://". A new helper detects HTTPS endpoints; when TLS is enabled solely by the endpoint, CA/cert/min-version fields remain unset. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.4)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/controllers/observability/tempo_components.go`:
- Around line 78-80: The TLS cert reference is inconsistent:
tempo.Spec.Storage.TLS.Cert is set to tempoStorageSecretName(instance.Name)
while the actual secret created in tempoStackSecrets uses
tempoSecretName(instance.Name). Update the reference so both use the same
helper; e.g., change the assignment to tempo.Spec.Storage.TLS.Cert =
tempoSecretName(instance.Name) (or alternatively change tempoStackSecrets to
emit tempoStorageSecretName) so tempo.Spec.Storage.TLS.Cert, tempoStackSecrets,
tempoSecretName and tempoStorageSecretName are consistent.
- Around line 107-109: The function s3hasHTTPSEndpoint currently checks
storageSpec.S3.Endpoint with a case-sensitive HasPrefix; update
s3hasHTTPSEndpoint to first guard storageSpec.S3 and storageSpec.S3.Endpoint for
nil/empty, then TrimSpace on storageSpec.S3.Endpoint and perform a
case-insensitive prefix check for "https://" (e.g.,
strings.HasPrefix(strings.ToLower(trimmedEndpoint), "https://")) so inputs like
" HTTPS://..." or "https://..." are correctly recognized as HTTPS endpoints.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8200a183-47dd-46c7-b533-64de21e0fa23
📒 Files selected for processing (1)
pkg/controllers/observability/tempo_components.go
| if tls.CertSecret != nil { | ||
| tempo.Spec.Storage.TLS.Cert = tempoStorageSecretName(instance.Name) | ||
| } |
There was a problem hiding this comment.
TLS cert secret reference does not match the generated TLS secret name
At Line 79, TempoStack is configured to read certs from tempoStorageSecretName(instance.Name), but the TLS secret built in tempoStackSecrets uses tempoSecretName(instance.Name) (Line 168). This mismatch can break TLS cert mounting at runtime.
Proposed fix
--- a/pkg/controllers/observability/tempo_components.go
+++ b/pkg/controllers/observability/tempo_components.go
@@
objectStorageTLSSecret = &corev1.Secret{
TypeMeta: metav1.TypeMeta{
Kind: "Secret",
APIVersion: corev1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
- Name: tempoSecretName(instance.Name),
+ Name: tempoStorageSecretName(instance.Name),
Namespace: instance.Namespace,
},
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@pkg/controllers/observability/tempo_components.go` around lines 78 - 80, The
TLS cert reference is inconsistent: tempo.Spec.Storage.TLS.Cert is set to
tempoStorageSecretName(instance.Name) while the actual secret created in
tempoStackSecrets uses tempoSecretName(instance.Name). Update the reference so
both use the same helper; e.g., change the assignment to
tempo.Spec.Storage.TLS.Cert = tempoSecretName(instance.Name) (or alternatively
change tempoStackSecrets to emit tempoStorageSecretName) so
tempo.Spec.Storage.TLS.Cert, tempoStackSecrets, tempoSecretName and
tempoStorageSecretName are consistent.
| func s3hasHTTPSEndpoint(storageSpec obsv1alpha1.TracingObjectStorageSpec) bool { | ||
| if storageSpec.S3 != nil && strings.HasPrefix(storageSpec.S3.Endpoint, "https://") { | ||
| return true |
There was a problem hiding this comment.
HTTPS detection is too strict and can miss valid HTTPS endpoints
strings.HasPrefix(endpoint, "https://") is case-sensitive and does not trim whitespace. Inputs like HTTPS://... or " https://..." won’t enable TLS, even though they are logically HTTPS endpoints.
Proposed fix
func s3hasHTTPSEndpoint(storageSpec obsv1alpha1.TracingObjectStorageSpec) bool {
- if storageSpec.S3 != nil && strings.HasPrefix(storageSpec.S3.Endpoint, "https://") {
- return true
- }
- return false
+ if storageSpec.S3 == nil {
+ return false
+ }
+ endpoint := strings.TrimSpace(storageSpec.S3.Endpoint)
+ return strings.HasPrefix(strings.ToLower(endpoint), "https://")
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| func s3hasHTTPSEndpoint(storageSpec obsv1alpha1.TracingObjectStorageSpec) bool { | |
| if storageSpec.S3 != nil && strings.HasPrefix(storageSpec.S3.Endpoint, "https://") { | |
| return true | |
| func s3hasHTTPSEndpoint(storageSpec obsv1alpha1.TracingObjectStorageSpec) bool { | |
| if storageSpec.S3 == nil { | |
| return false | |
| } | |
| endpoint := strings.TrimSpace(storageSpec.S3.Endpoint) | |
| return strings.HasPrefix(strings.ToLower(endpoint), "https://") | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@pkg/controllers/observability/tempo_components.go` around lines 107 - 109,
The function s3hasHTTPSEndpoint currently checks storageSpec.S3.Endpoint with a
case-sensitive HasPrefix; update s3hasHTTPSEndpoint to first guard
storageSpec.S3 and storageSpec.S3.Endpoint for nil/empty, then TrimSpace on
storageSpec.S3.Endpoint and perform a case-insensitive prefix check for
"https://" (e.g., strings.HasPrefix(strings.ToLower(trimmedEndpoint),
"https://")) so inputs like " HTTPS://..." or "https://..." are correctly
recognized as HTTPS endpoints.
a4f6d14 to
f526580
Compare
Test Results: ObservabilityInstaller S3 HTTPS endpoint fixCommit: Setup
Results
Details
Note on Azure / GCSThe fix only checks S3 endpoints (
|
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
jan--f
left a comment
There was a problem hiding this comment.
Just one small question, otherwise this looks good.
| } | ||
|
|
||
| func s3hasHTTPSEndpoint(storageSpec obsv1alpha1.TracingObjectStorageSpec) bool { | ||
| if storageSpec.S3 != nil && strings.HasPrefix(storageSpec.S3.Endpoint, "https://") { |
There was a problem hiding this comment.
nit: Should this perhaps use the url package?
This PRs enables HTTPS/TLS in TempoStack when
https://is specified in the object storage endpoint.Before this PR the HTTPS could be be enabled with the following CR: