PSAP-2185: Support centralized TLS security profile configuration#1483
PSAP-2185: Support centralized TLS security profile configuration#1483jmencak wants to merge 1 commit intoopenshift:mainfrom
Conversation
Add support for the OpenShift centralized TLS security profile feature, allowing the operator to dynamically configure its webhook and metrics servers based on the cluster's APIServer TLS settings. The operator now: - Fetches the TLS security profile from the cluster's APIServer resource at startup - Applies the TLS configuration to both the webhook and metrics servers - Watches for changes to the APIServer TLS profile and gracefully restarts to apply updates This ensures the operator respects cluster-wide TLS policy for all its server endpoints. The implementation works for both classic OpenShift clusters and HyperShift hosted clusters. In HyperShift mode, the operator fetches the TLS profile from the hosted cluster's APIServer. Changes: - Import controller-runtime-common library for TLS profile utilities. - Add SecurityProfileWatcher controller to monitor APIServer changes. - Update RBAC to allow access to "config.openshift.io/apiservers". - Configure metrics/webhook servers with central TLS settings. - Add fallback to default profile on errors. Resolves: PSAP-2185; also see: OCPSTRAT-2611
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (4)
WalkthroughThe PR implements dynamic TLS profile loading in the cluster node tuning operator. It introduces initial TLS profile fetching from the API server with a fallback mechanism, adds a TLS profile watcher for detecting changes, and enables graceful context-based lifecycle management. The metrics server gains an injectable TLS configuration hook, and RBAC rules are updated to permit API server access. Changes
Sequence Diagram(s)sequenceDiagram
participant Startup as Operator Startup
participant APIServer as API Server
participant TLSFetch as getInitialTLSProfile
participant Manager as Manager
participant Watcher as TLS Profile Watcher
participant Context as Cancellable Context
Startup->>TLSFetch: Initiate TLS profile loading
TLSFetch->>APIServer: Fetch TLSProfileSpec
APIServer-->>TLSFetch: Return TLS profile or fallback
TLSFetch->>TLSFetch: Build TLS config
TLSFetch-->>Startup: Return profile & config
Startup->>Watcher: setupTLSProfileWatcher()
Watcher->>APIServer: Watch config.openshift.io/apiservers
Startup->>Manager: Start manager with context
Manager-->>Startup: Manager running
APIServer->>Watcher: TLS profile changed
Watcher->>Context: Cancel context
Context->>Manager: Context cancelled
Manager->>Startup: Manager stops for reload
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: inconsistent vendoring in :\n\tgithub.com/RHsyseng/operator-utils@v1.4.13: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/coreos/go-systemd@v0.0.0-20191104093116-d3cd4ed1dbcf: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/coreos/ignition@v0.35.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/coreos/ignition/v2@v2.26.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/docker/go-units@v0.5.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/go-logr/stdr@v1.2.2: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/google/go-cmp@v0.7.0 ... [truncated 19339 characters] ... is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/legacy-cloud-providers: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/metrics: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/mount-utils: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/pod-security-admission: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/sample-apiserver: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tgithub.com/onsi/ginkgo/v2: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\n\tTo ignore the vendor directory, use -mod=readonly or -mod=mod.\n\tTo sync the vendor directory, run:\n\t\tgo mod vendor\n" Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jmencak 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 |
|
/retest |
|
@jmencak: 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. |
|
@jmencak: An error was encountered searching for bug PSAP-2185 on the Jira server at https://issues.redhat.com. No known errors were detected, please see the full error message for details. Full error message.
request failed. Please analyze the request body for more details. Status code: 403:
Please contact an administrator to resolve this issue, then request a bug refresh with 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. |
|
/jira refresh |
|
@jmencak: An error was encountered searching for bug PSAP-2185 on the Jira server at https://issues.redhat.com. No known errors were detected, please see the full error message for details. Full error message.
request failed. Please analyze the request body for more details. Status code: 403:
Please contact an administrator to resolve this issue, then request a bug refresh with 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. |
|
@jmencak: The referenced Jira(s) [PSAP-2185] could not be located, all automatically applied jira labels will be removed. 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. |
|
/cc @swatisehgal @shajmakh PTAL as well |
|
@yanirq: GitHub didn't allow me to request PR reviews from the following users: PTAL, as, well. Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs. 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 kubernetes-sigs/prow repository. |
Add support for the OpenShift centralized TLS security profile feature, allowing the operator to dynamically configure its webhook and metrics servers based on the cluster's APIServer TLS settings.
The operator now:
This ensures the operator respects cluster-wide TLS policy for all its server endpoints.
The implementation works for both classic OpenShift clusters and HyperShift hosted clusters. In HyperShift mode, the operator fetches the TLS profile from the hosted cluster's APIServer.
Changes:
Resolves: PSAP-2185; also see: OCPSTRAT-2611
Summary by CodeRabbit
New Features
Chores