Conversation
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tolusha 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 |
This comment was marked as outdated.
This comment was marked as outdated.
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
|
Hi! I'm che-ai-assistant — I help with your pull requests. Available commands:
|
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
…e http client Signed-off-by: Anatolii Bazko <abazko@redhat.com>
|
/che-ai-assistant ok-pr-review Review is complete. Please check the review comments below. |
tolusha
left a comment
There was a problem hiding this comment.
Code Review Summary
Completed comprehensive review (standard + deep + impact analysis) of this PR.
Does This PR Solve the Issue?
✅ Yes - enables DWO to use merged DevWorkspaceOperatorConfig for TLS certificate initialization.
Critical Issues Identified
- Transient ConfigMap failure silently strips custom certificates - When
readCertCMfails, the client rebuilds without custom certs, breaking TLS trust cluster-wide - TOCTOU race between shouldRebuildClients and setNewClients - Concurrent reconciliations can both rebuild clients
- Shared HTTP client with per-workspace config - Last reconciled workspace's config wins globally
Positive Highlights
- Clean
HttpClientsHolderinterface design - Excellent test coverage (8 test cases)
- Fixed pre-existing response body leak in
status.go - Smart rebuild optimization logic
Recommendations
See inline comments for detailed findings and suggested fixes.
Verdict: 🔄 Request Changes - Critical #1 directly undermines the PR's purpose. Once fixed, this is a solid, well-tested change.
Review generated by Claude Code using /ok-pr-review suite
|
|
||
| return false, false | ||
| } | ||
|
|
There was a problem hiding this comment.
Critical: Transient ConfigMap failure silently strips custom certificates
When readCertCM fails (transient API error, RBAC issue), newCertsCM becomes nil. The shouldRebuildClients method then detects a "change" and rebuilds the HTTP client with getCaCertPool(nil), stripping all custom CA certificates.
A single transient Kubernetes API error will break TLS trust cluster-wide for all subsequent workspace operations.
Suggested fix: On readCertCM failure, return early without rebuilding clients. Only rebuild when we successfully read a ConfigMap with a different ResourceVersion.
if routingConfig.TLSCertificateConfigmapRef != nil {
certsCM, err := h.readCertCM(ctx, routingConfig.TLSCertificateConfigmapRef)
if err != nil {
h.logger.Error(err, "Failed to read TLS certificate ConfigMap")
// Preserve existing HTTP clients on transient failure
return
}
newCertsCM = certsCM
}|
|
||
| // Always rebuild if clients haven't been initialized yet | ||
| if h.client == nil || h.healthCheckHttpClient == nil { | ||
| return true, true |
There was a problem hiding this comment.
Race condition: TOCTOU gap between shouldRebuildClients and setNewClients
ConfigureHttpClients calls shouldRebuildClients (RLock), then buildNewClients (no lock), then setNewClients (Lock). Between releasing the RLock and acquiring the Lock, another concurrent reconciliation could also pass the check and both would rebuild clients.
Suggested fix: Use a single Lock for the entire ConfigureHttpClients method to make check-and-set atomic.
| } | ||
|
|
||
| return false, false | ||
| } |
There was a problem hiding this comment.
Comment contradicts actual behavior
The comment says "not an issue at all" but this IS an issue - the operator was configured to trust custom certificates. Rebuilding without them on transient failure breaks the trust chain.
Consider updating this comment after fixing the transient failure handling.
| workspace.DevWorkspace = rawWorkspace | ||
| workspace.Config = config | ||
|
|
||
| httpClientsHolder.ConfigureHttpClients(ctx, config.Routing) |
There was a problem hiding this comment.
System-level concern: Shared HTTP client with per-workspace config
The httpClientsHolder is shared across ALL concurrent reconciliations. If different workspaces have different merged TLSCertificateConfigmapRef values, the "last reconciled workspace wins" for HTTP client configuration.
Needs verification: Does DWOC merging always produce identical routing config regardless of workspace? Or can per-namespace overrides create different cert references?
If configs can differ, consider scoping the HTTP client holder per-namespace or per-config-hash.
What does this PR do?
This PR changes the HTTP client initialization to use the merged DevWorkspaceOperatorConfig instead of only the global config.
What issues does this PR fix or reference?
eclipse-che/che#23870
eclipse-che/che-operator#2137
Is it tested? How?
Followed eclipse-che/che-operator#2137
PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-pathto trigger)v8-devworkspace-operator-e2e: DevWorkspace e2e testv8-che-happy-path: Happy path for verification integration with CheSummary by CodeRabbit
Release Notes