CORENET-7497: Honor cluster TLS profile - #135
alebedev87 wants to merge 2 commits into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@alebedev87: This pull request references CORENET-7497 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 epic to target the "5.1.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. |
|
Caution CodeRabbit couldn't post its review summary. Error details |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alebedev87 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 |
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughThe operator now loads the OpenShift cluster TLS profile and applies its TLS options to metrics and webhook servers. It watches profile changes and triggers the configured restart callback. Startup uses a shared cancellable context and Kubernetes configuration. CSV declarations and RBAC rules enable TLS profile support and APIServer access. API scheme registration and Go dependencies were updated.
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No actionable issue remains in the reviewed changes; the focused test was blocked by unavailable local test infrastructure rather than a code failure. Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (2 errors, 1 warning)
✅ Passed checks (12 passed)
Full details: No-Weak-CryptoExplanation The PR introduces a runtime path that can enable weak TLS algorithms. Resolution Filter prohibited cipher suites before creating or applying Full details: No-Sensitive-Data-In-LogsExplanation The new TLS-profile fetch can log raw Kubernetes client errors. Resolution Sanitize Kubernetes client and watcher errors before logging. Do not pass raw REST or transport errors to ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/test e2e-aws-operator |
abe04a2 to
f8be52c
Compare
Watch `apiservers/cluster` and apply `tlsSecurityProfile`, including groups, when `tlsAdherence` is `Strict`. Honoring the profile's group/curve preferences requires the newer `controller-runtime-common`, which in turn bumps k8s to `0.36` and controller-runtime to `0.24`. Mark the CSV as tls-profiles capable. Co-Authored-By: Cursor Co-Authored-By: Claude
The controller-runtime `0.24` bump marks `sigs.k8s.io/controller-runtime/pkg/scheme.Builder` as deprecated, which `staticcheck` (`SA1019`) flags in the `lint` CI job. The deprecation asks api packages to depend only on `k8s.io/apimachinery`. Replace `scheme.Builder` with apimachinery's `runtime.SchemeBuilder` and pass `GroupVersion` explicitly at registration time via `AddKnownTypes` in each `_types.go`, keeping the `metav1.AddToGroupVersion` call that the controller-runtime builder performed implicitly. Co-Authored-By: Claude
f8be52c to
57463fe
Compare
|
@alebedev87: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
This makes the operator honor the cluster-wide TLS security profile (
apiservers.config.openshift.io/cluster) on its own TLS servers (metrics and webhook), instead of always serving with the controller-runtime defaults.At startup the operator reads
apiservers/clusterand, whentlsAdherenceisStrict, translates the clustertlsSecurityProfileintotls.Configoptions — minimum TLS version, cipher suites, and the group/curve preferences (CurvePreferences) — which are appended to the manager'sTLSOpts. WhentlsAdherenceisLegacy(or theAPIServer/config API is unavailable, e.g. on non-OpenShift clusters), no options are applied and the servers keep their existing defaults, so the change degrades gracefully.A watch on the profile is also registered: if the
tlsSecurityProfileortlsAdherencechanges at runtime, the operator cancels the manager context and exits, letting the Deployment restart the pod so the new profile takes effect.mainis restructured to share a single cancelable context and client between the profile lookup, the watch, andmgr.Start.Honoring the profile's group/curve preferences requires the newer
controller-runtime-common, whoseNewTLSConfigFromProfilehelper setsCurvePreferences. Adopting that version transitively bumpsk8s.io/*to0.36andsigs.k8s.io/controller-runtimeto0.24.🤖 Generated with Claude Code
Test on 4.22
TLSAdherencefeaturegate had to be explicitly enabled, not yet GA on 4.22.