feat: add SecurityProfileWatcher for TLS profile change detection #156
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.71) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.71 · 533 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.376
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.071
Real PR Conversation Timeline
1 comments
"Review active on #156"
general
weight: 0.35
RobuRishabh
Purpose of this PR
Add a SecurityProfileWatcher to both controller and webhook that detects changes to the OpenShift APIServer TLS security profile and triggers a graceful restart. This brings spark-operator in line with the TLS adherence requirements (RHOAIENG-79437, RHOAIENG-79005).
Proposed changes:
pkg/tls/profile.go(was duplicated inline)pkg/tls/watcher.gowith an unstructured controller that watches the APIServerclusterobject and fires a cancel callback on profile changesconfig.openshift.io/apiserversRBAC to ODH/RHOAI overlay (not needed in upstream base), addlist/watchverbs for the informer--enable-http2flag from webhook (already removed upstream in kubeflow/spark-operator#2990)Provider.TLSConfig()method frompkg/certificate/certificate.go(upstream PR: kubeflow/spark-operator#3062)pkg/tls/and add comprehensive watcher unit tests (35 tests)Change Category
Rationale
OCP 5 TLS compliance requires operators to respect the cluster-wide TLS security profile and restart when it changes. The webhook already fetched the profile at startup but neither component watched for changes. The controller didn't fetch the profile at all (used CLI flags only).
The
--enable-http2flag was a downstream-only addition that was never in upstream. It was already removed upstream in #2990 as dead code after CVE-2023-44487 was fixed in Go 1.21.3+.The
Provider.TLSConfig()method was introduced upstream in #2072 but never called. It creates a baretls.Configwithout honoring the cluster TLS profile, which gets flagged by tls-lint.Checklist
Additional Notes
Ref: RHOAIENG-79437, RHOAIENG-79005
Upstream PRs:
--enable-http2, merged)TLSConfig(), open)[RHOAIENG-79437]: https://redhat.atlassian.net/browse/RHOAIENG-79437?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[RHOAIENG-79005]: https://redhat.atlassian.net/browse/RHOAIENG-79005?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[RHOAIENG-79437]: https://redhat.atlassian.net/browse/RHOAIENG-79437?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Added automatic integration with OpenShift TLS security profiles.
TLS settings now support profile-based versions and cipher suites, with HTTP/2 and HTTP/1.1 enabled.
Added automatic detection of TLS profile changes, triggering service reconfiguration.
Added required permissions for monitoring TLS profile updates.
Bug Fixes
* Improved handling of missing, malformed, and temporarily unavailable TLS profiles with safer fallbacks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->