Skip to content

feat: integrate with cluster TLS security profile - #824

Merged
ruivieira merged 1 commit into
trustyai-explainability:mainfrom
ugiordan:RHOAIENG-61068-tls-profile
Aug 22, 2026
Merged

ruivieira merged 1 commit into
trustyai-explainability:mainfrom
ugiordan:RHOAIENG-61068-tls-profile

Conversation

@ugiordan

@ugiordan ugiordan commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Integrates with the OpenShift cluster TLS security profile (tls.openshift.io/v1alpha1) to configure TLS settings for the operator's metrics and webhook servers
  • Adds transient error handling for TLS profile resolution: gracefully falls back to hardened defaults (TLS 1.2 minimum) when the API server is temporarily unavailable (ServiceUnavailable, Timeout, TooManyRequests, context.DeadlineExceeded)
  • Fixes the EvalHub webhook server override to include TLSOpts, ensuring consistent TLS enforcement regardless of which code path creates the webhook server

Test plan

  • Verify operator starts correctly on a cluster with a TLS security profile configured
  • Verify operator starts correctly on a cluster without TLS security profile (falls back to TLS 1.2 defaults)
  • Verify EvalHub webhook server uses the TLS profile when EvalHub is enabled
  • Verify metrics server uses the TLS profile
  • Verify transient API errors during TLS profile fetch result in graceful fallback, not crash

Summary by CodeRabbit

  • Security
    • Added automatic TLS profile detection for supported OpenShift environments.
    • Applies secure minimum TLS versions, cipher suites, and HTTP protocols to webhook services.
    • Uses hardened TLS defaults when the platform profile is unavailable or still initializing.
    • Prevents startup when an unexpected TLS configuration error occurs.
  • Bug Fixes
    • Ensured the EvalHub webhook server uses the resolved TLS settings in addition to its configured port.

@openshift-ci

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown

Hi @ugiordan. Thanks for your PR.

I'm waiting for a trustyai-explainability member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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 kubernetes-sigs/prow repository.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ugiordan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48a0453d-a358-447a-88bf-38d55b1cac3d

📥 Commits

Reviewing files that changed from the base of the PR and between 29a3794 and 5888729.

📒 Files selected for processing (2)
  • cmd/main.go
  • pkg/tls/tls.go
📝 Walkthrough

Walkthrough

Adds OpenShift TLS profile resolution with bounded lookup, fallback handling, cipher and protocol parsing, and applies the resulting TLS options to the EvalHub webhook server.

Changes

TLS profile integration

Layer / File(s) Summary
TLS profile resolution
pkg/tls/tls.go
Maps TLS versions and ciphers, parses OpenShift profiles, fetches the APIServer resource with a timeout, handles expected lookup failures with intermediate defaults, and returns controller-runtime TLS options.
EvalHub webhook TLS wiring
cmd/main.go
Configures the EvalHub webhook server with the resolved TLSOpts in addition to its port.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: ok-to-test

Suggested reviewers: ruivieira, abeltramo, robgeada

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: integrating the operator with the cluster TLS security profile.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/main.go`:
- Around line 121-123: Update the ctrl.Options Metrics configuration to set
SecureServing: true alongside the existing TLSOpts, ensuring the resolved TLS
profile is applied to the metrics endpoint.

In `@pkg/tls/tls.go`:
- Around line 104-111: The Kubernetes error classification in the TLS fallback
handling must treat server-timeout responses as transient. Add
apierrors.IsServerTimeout(err) to the relevant condition alongside
apierrors.IsTimeout so it uses hardened defaults, and update the classification
tests to cover StatusReasonServerTimeout.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2d221508-8056-40bc-b18c-f5227851b36c

📥 Commits

Reviewing files that changed from the base of the PR and between 8b8db3b and 716ef6b.

📒 Files selected for processing (8)
  • cmd/main.go
  • config/rbac-base/kustomization.yaml
  • config/rbac-base/tls_profile_role.yaml
  • config/rbac-base/tls_profile_role_binding.yaml
  • pkg/tls/tls.go
  • pkg/tls/tls_test.go
  • policy/clusterrole.rego
  • policy/rbac.rego

Comment thread cmd/main.go
Comment thread pkg/tls/tls.go
@ugiordan
ugiordan force-pushed the RHOAIENG-61068-tls-profile branch from 716ef6b to 29a3794 Compare July 16, 2026 11:31
Applies TLSOpts to the EvalHub webhook server override that was
previously missing them, and adds handling for context.DeadlineExceeded
and apierrors.IsServerTimeout in the TLS profile resolution to prevent
crash loops during transient API server issues.

Signed-off-by: Ugo Giordano <ugiordan@redhat.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ugiordan
ugiordan force-pushed the RHOAIENG-61068-tls-profile branch from 29a3794 to 5888729 Compare July 16, 2026 11:35
@ugiordan

Copy link
Copy Markdown
Contributor Author

@ruivieira can you please help with this one?

@openshift-ci openshift-ci Bot added the lgtm label Aug 22, 2026
@openshift-ci

openshift-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ruivieira

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ruivieira ruivieira moved this to Done in TrustyAI planning Aug 22, 2026
@ruivieira
ruivieira merged commit 0e2b72e into trustyai-explainability:main Aug 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants