Conversation
Retrieve cluster tls profile on operator startup. Restart the operator when the cluster tls profile changes. Pass the tls profile to distributed_tracing console plugin
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ozzywalsh The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe operator now integrates OpenShift TLS profile management with graceful shutdown support. A cancel-derived context is introduced in main.go and passed to the operator, which establishes a TLS profile watcher that triggers cancellation on profile changes. Dependencies are updated, and the scheme conditionally registers OpenShift config/v1 API types. Changes
Sequence Diagram(s)sequenceDiagram
participant SignalHandler as Signal Handler
participant Main as main()
participant Operator as Operator
participant TLSWatcher as TLS Profile Watcher
participant Manager as Manager
SignalHandler->>Main: SetupSignalHandler()
rect rgba(100, 150, 200, 0.5)
Main->>Main: context.WithCancel(signalCtx)
Main->>Main: defer cancel()
end
Main->>Operator: New(..., WithCancelFunc(cancel))
rect rgba(100, 150, 200, 0.5)
Operator->>TLSWatcher: FetchAPIServerTLSProfile()
Operator->>TLSWatcher: NewSecurityProfileWatcher(OnProfileChange)
Operator->>Manager: SetupWithManager()
end
Manager->>Manager: Start()
alt Profile Change Detected
TLSWatcher->>TLSWatcher: OnProfileChange callback
TLSWatcher->>Operator: cancel() invoked
Operator->>Manager: Graceful shutdown
else Signal Received
SignalHandler->>Operator: signalCtx cancelled
Operator->>Manager: Graceful shutdown
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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.11.4)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions 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. Comment |
|
Hi @ozzywalsh. Thanks for your PR. I'm waiting for a rhobs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/operator/operator.go`:
- Around line 335-345: The OnProfileChange callback on SecurityProfileWatcher
currently calls cfg.CancelFunc() without checking for nil; update the anonymous
function passed to openshifttls.SecurityProfileWatcher (OnProfileChange) to
first verify cfg.CancelFunc != nil before invoking it, and retain the existing
log message and behavior otherwise; ensure this defensive check is applied where
watcher is configured (before calling watcher.SetupWithManager).
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3012d44f-d519-49bb-a4b5-7c654226ed70
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (8)
cmd/operator/main.gogo.modpkg/controllers/uiplugin/controller.gopkg/controllers/uiplugin/distributed_tracing.gopkg/controllers/uiplugin/distributed_tracing_test.gopkg/controllers/uiplugin/plugin_info_builder.gopkg/operator/operator.gopkg/operator/scheme.go
simonpasquier
left a comment
There was a problem hiding this comment.
as commented over Slack, I'd prefer this PR to focus only on watching the TLS profile. Propagation to UI plugins should be a follow-up.
go.mod
Outdated
| github.com/rhobs/observability-operator/pkg/apis => ./pkg/apis | ||
| ) | ||
|
|
||
| require ( |
There was a problem hiding this comment.
(nit) can we move this to the top-level require section?
pkg/operator/operator.go
Outdated
| if cfg.FeatureGates.OpenShift.Enabled { | ||
| setupLog := ctrl.Log.WithName("setup") | ||
|
|
||
| // Create a temporary client to fetch initial TLS profile before manager starts. |
There was a problem hiding this comment.
question: isn't the manager's client ready to use at this stage?
There was a problem hiding this comment.
Good catch; i've updated it to use the manager's client.
Separate TLS profile retrieval from passing TLS profile into the console plugin, so they can be reviewed in independent PRs.
| if cfg.FeatureGates.OpenShift.Enabled { | ||
| setupLog := ctrl.Log.WithName("setup") | ||
|
|
||
| initialTLSProfileSpec, err := openshifttls.FetchAPIServerTLSProfile(ctx, mgr.GetClient()) |
There was a problem hiding this comment.
Can any authenticated user read the TLS profile? I'd expect that we need to grant some permission to the operator.
Changes
createDistributedTracingPluginInfoReference
Similar PR in
opentelemetry-operatoropen-telemetry/opentelemetry-operator#4669Dependencies/Questions
The PR below adds the to
--tls-min-version&--tls-cipher-suitesto the actual console plugin.https://github.com/openshift/distributed-tracing-console-plugin
It should probably be released first, and the the
observability-operator; to avoid a situation where theobservability-operatoris injecting flags that the plugin doesn't expect; since this would probably throw an error & break things.