fix(tektonresult): default route TLS termination to reencrypt - #4029
fix(tektonresult): default route TLS termination to reencrypt#4029divyansh42 wants to merge 2 commits into
Conversation
The Results API route was defaulting to `edge` TLS termination which causes TLS handshake failures: the router terminates TLS and forwards unencrypted traffic to the gRPC backend, which only speaks TLS. `reencrypt` is the correct mode: the router presents a trusted cert to external clients while re-encrypting to the backend (which has an OpenShift service-serving cert). This eliminates the need for `--insecure-skip-tls-verify` when using `opc results`. Changes: - Default `route_tls_termination` changed from `edge` to `reencrypt` - Route YAML updated from `passthrough` to `reencrypt` - Fix RBAC `resourceNames` from `tekton-results-api-service` to `tekton-results-api` to match the actual Route resource name - Add validation: only `edge`, `reencrypt`, `passthrough` are accepted Signed-off-by: divyansh42 <diagrawa@redhat.com> Assisted-by: Claude Sonnet 4.6 (via Cursor) Co-authored-by: Cursor <cursoragent@cursor.com>
a1fc393 to
9146282
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4029 +/- ##
==========================================
+ Coverage 26.44% 26.47% +0.03%
==========================================
Files 465 465
Lines 24991 25002 +11
==========================================
+ Hits 6609 6620 +11
Misses 17661 17661
Partials 721 721
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Existing installations are not migrated, TektonConfig bypasses the new validation, and stale test expectations will fail.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates OpenShift Results routes to use re-encrypt TLS and validates supported termination modes.
Changes:
- Defaults route TLS termination to
reencrypt. - Updates route manifests and RBAC resource names.
- Adds validation and tests for TLS termination values.
File summaries
| File | Description |
|---|---|
pkg/reconciler/openshift/tektonresult/testdata/static/tekton-results/route-rbac/rbac.yaml |
Updates test route and RBAC. |
pkg/reconciler/openshift/tektonresult/extension_test.go |
Tests re-encrypt route injection. |
pkg/apis/operator/v1alpha1/tektonresult_validation.go |
Validates termination modes. |
pkg/apis/operator/v1alpha1/tektonresult_validation_test.go |
Tests termination validation. |
pkg/apis/operator/v1alpha1/tektonresult_defaults.go |
Changes the default to re-encrypt. |
pkg/apis/operator/v1alpha1/tektonresult_defaults_test.go |
Updates the primary default assertion. |
cmd/openshift/operator/kodata/static/tekton-results/route-rbac/rbac.yaml |
Updates deployed route and RBAC. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ResultsAPIProperties: ResultsAPIProperties{ | ||
| RouteEnabled: ptr.Bool(true), | ||
| RouteTLSTermination: "edge", | ||
| RouteTLSTermination: "reencrypt", |
| if c.RouteTLSTermination == "" { | ||
| c.RouteTLSTermination = "edge" | ||
| c.RouteTLSTermination = "reencrypt" |
| if trs.RouteTLSTermination != "" { | ||
| switch trs.RouteTLSTermination { | ||
| case "edge", "reencrypt", "passthrough": |
- Fix 6 stale RouteTLSTermination: "edge" assertions in TestResult_SetDefaultsBucketsAutoDefaulting; all now expect "reencrypt" to match the updated SetDefaults output. - Extract route TLS termination validation into a dedicated method ResultsAPIProperties.validateRouteTLSTermination so it can be called from both TektonResult.Validate and TektonConfig.Validate. - Add the validation call to TektonConfig.Validate so an invalid spec.result.route_tls_termination is rejected at the parent CR level before the child TektonResult reconcile ever fires. - Add Test_ValidateTektonConfig_InvalidResultRouteTLSTermination to cover the new TektonConfig validation path. Signed-off-by: divyansh42 <diagrawa@redhat.com> Assisted-by: Claude Sonnet 4.6 (via Cursor) Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed the Copilot review comments in the follow-up commit (06d301f):
|
There was a problem hiding this comment.
🔵 Needs a closer look
The release note overstates external certificate trust, which still depends on the cluster ingress certificate configuration.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
cmd/openshift/operator/kodata/static/tekton-results/route-rbac/rbac.yaml:61
- The PR states that this eliminates
--insecure-skip-tls-verify, butreencryptonly changes router-to-backend encryption; this Route still presents the cluster ingress certificate. A default OpenShift ingress certificate is internally signed and may remain untrusted by external clients. Please qualify the description/release note so this benefit is conditional on clients trusting the ingress CA (or on a trusted custom ingress certificate being configured).
- Files reviewed: 9/9 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
Don't we also need to handle the upgrade scenario (updating TLS termination |
|
@divyansh42 can you adress @pratap0007 concerns? what happens on upgrade, please post a proof of work |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enarha The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@divyansh42 can we deprecate passthroug ? |
Changes
The Results API route on OpenShift was defaulting to
edgeTLS termination,which causes TLS handshake failures when clients try to connect. The router
terminates TLS at the edge and forwards unencrypted traffic to the gRPC
backend — but the backend only speaks TLS.
Additionally, when
passthroughwas used as a workaround, clients had topass
--insecure-skip-tls-verifybecause the OpenShift service-servingcertificate was not trusted by external clients.
reencryptis the correct termination type:--insecureneeded)Changes made
tektonresult_defaults.goroute_tls_terminationchanged fromedge→reencryptroute-rbac/rbac.yaml(kodata)passthrough→reencryptroute-rbac/rbac.yaml(testdata)resourceNamesfixed:tekton-results-api-service→tekton-results-api(matches actual Route name)tektonresult_validation.goedge,reencrypt,passthroughacceptedtektonresult_validation_test.gotektonresult_defaults_test.goreencryptextension_test.goreencrypttest case for route injectionSubmitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make test lintbefore submitting a PRSee the contribution guide for more details.
Release Notes
Made with Cursor