Skip to content

[ACM-35533] Depricate use of BYO CA certs for alertmanager#2568

Merged
openshift-merge-bot[bot] merged 5 commits into
stolostron:mainfrom
dbuchanaRH:patch-alertmanager-byo-cert
Jul 15, 2026
Merged

[ACM-35533] Depricate use of BYO CA certs for alertmanager#2568
openshift-merge-bot[bot] merged 5 commits into
stolostron:mainfrom
dbuchanaRH:patch-alertmanager-byo-cert

Conversation

@dbuchanaRH

@dbuchanaRH dbuchanaRH commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Cleanup of BYO CA certs functionality not currently used

modified Function

Function File Purpose
GenerateAlertmanagerRoute() multiclusterobservability_controller.go Created/updated the Alertmanager OpenShift Route; applied BYO CA/cert TLS when secrets present

removed Functions

Function File Purpose
GetAlertManagerSecretPredicateFunc() predicate_func.go Triggered reconcile on AM BYO cert secret create/update/delete; also watched alertmanager-config delete and backup-label secrets
GetAlertmanagerRouterCA() pkg/config/config.go Resolved router CA (BYO secrets first, else ingress default cert). Had no callers — dead code
amRouterCertSecretPred (inline) placementrule_controller.go Watched AM BYO cert secrets and triggered updateHubInfoSecret()
newTestAmRouteBYOCA() / newTestAmRouteBYOCert() hub_info_secret_test.go Test fixtures for BYO cert secrets
GetAlertmanagerURL() pkg/config/config.go Resolve external alertmanager URL

Controller Wiring Removed

MCO reconciler (multiclusterobservability_controller.go)

  • Reconcile() — removed call to GenerateAlertmanagerRoute()
  • SetupWithManager() — removed secretPred := GetAlertManagerSecretPredicateFunc() and the associated Secret watch

PlacementRule reconciler (placementrule_controller.go)

  • Removed Secret watch using amRouterCertSecretPred for AM BYO cert changes

Not Removed (out of scope for this PR)

  • ProxyRouteBYOCAName / ProxyRouteBYOCERTName — proxy route BYO cert support remains
  • MCO operator creates the Alertmanager OpenShift Route — needed for e2e tests

Behavioral Impact

Summary by CodeRabbit

Summary by CodeRabbit

  • Changes
    • Alertmanager is no longer exposed through a dedicated Route.
    • Alertmanager BYO certificate/CA handling for that Route has been removed, so Alertmanager route TLS fields are no longer managed.
    • Updates to Alertmanager route/certificate resources and related configuration no longer trigger reconciliation.
    • API Gateway, RBAC proxy, and Grafana endpoints continue to be exposed.

Signed-off-by: Daniel Buchanan <dbuchana@redhat.com>
Signed-off-by: Daniel Buchanan <dbuchana@redhat.com>
Signed-off-by: Daniel Buchanan <dbuchana@redhat.com>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4a1f8f16-0523-42ed-bcf8-ac3445854b96

📥 Commits

Reviewing files that changed from the base of the PR and between 5b86f0d and ce0b41c.

📒 Files selected for processing (1)
  • operators/multiclusterobservability/pkg/config/config.go

📝 Walkthrough

Walkthrough

Alertmanager Route exposure and BYO Route support were removed from configuration, reconciliation, controller watches, placement-rule wiring, and associated test fixtures.

Changes

Alertmanager Route removal

Layer / File(s) Summary
Remove Alertmanager Route configuration
operators/multiclusterobservability/pkg/config/config.go, operators/multiclusterobservability/pkg/config/config_test.go
Removed Alertmanager Route BYO constants, URL and router CA helpers, backup mappings, and endpoint coverage.
Remove Route reconciliation and watches
operators/multiclusterobservability/controllers/multiclusterobservability/..., operators/multiclusterobservability/controllers/placementrule/...
Removed Alertmanager Route generation, BYO TLS injection, configuration-secret watches, and Alertmanager secret predicate wiring.
Align integration and unit fixtures
operators/multiclusterobservability/controllers/.../*_test.go
Removed Alertmanager Route objects, BYO secret fixtures, helper functions, and TLS assertions from controller and placement-rule tests.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested labels: lgtm

Suggested reviewers: thibaultmg, thibaultmg

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% 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: removing BYO CA/cert support for Alertmanager.
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
operators/multiclusterobservability/controllers/placementrule/hub_info_secret_test.go (1)

227-230: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Mark CustomAlertmanagerHubURL deprecated in AdvancedConfig. It’s still exposed in the API/CRD, so users can keep flipping a switch that now controls nothing. Add a deprecation note in operators/multiclusterobservability/api/v1beta2/multiclusterobservability_types.go and regenerate the CRD/bundle, or remove it once compatibility allows.

🤖 Prompt for 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.

In
`@operators/multiclusterobservability/controllers/placementrule/hub_info_secret_test.go`
around lines 227 - 230, Mark AdvancedConfig.CustomAlertmanagerHubURL as
deprecated in multiclusterobservability_types.go with an appropriate API
deprecation annotation and regenerate the corresponding CRD and bundle
artifacts; preserve the field for compatibility while clearly indicating it no
longer controls behavior.
🧹 Nitpick comments (1)
operators/multiclusterobservability/controllers/placementrule/hub_info_secret_test.go (1)

252-280: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

TestNewBYOSecret no longer tests a BYO scenario.

With the BYO alertmanager secrets gone, this test's fixtures/assertions are now the same shape as TestNewSecret's default-path case — just missing newTestIngressController()/newTestRouteCASecret(). The name is now a bit of a misnomer and the coverage looks largely duplicated. Consider renaming it to reflect what it actually verifies now, or folding it into TestNewSecret (e.g., as a subtest) to avoid maintaining two near-identical assertions.

🤖 Prompt for 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.

In
`@operators/multiclusterobservability/controllers/placementrule/hub_info_secret_test.go`
around lines 252 - 280, Update TestNewBYOSecret to reflect that it now verifies
the default hub info secret path rather than a BYO alertmanager scenario: either
rename it to a name describing the default-path behavior or fold it into
TestNewSecret as a subtest, while preserving the existing endpoint and CA
assertions and avoiding duplicate test coverage.
🤖 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.

Outside diff comments:
In
`@operators/multiclusterobservability/controllers/placementrule/hub_info_secret_test.go`:
- Around line 227-230: Mark AdvancedConfig.CustomAlertmanagerHubURL as
deprecated in multiclusterobservability_types.go with an appropriate API
deprecation annotation and regenerate the corresponding CRD and bundle
artifacts; preserve the field for compatibility while clearly indicating it no
longer controls behavior.

---

Nitpick comments:
In
`@operators/multiclusterobservability/controllers/placementrule/hub_info_secret_test.go`:
- Around line 252-280: Update TestNewBYOSecret to reflect that it now verifies
the default hub info secret path rather than a BYO alertmanager scenario: either
rename it to a name describing the default-path behavior or fold it into
TestNewSecret as a subtest, while preserving the existing endpoint and CA
assertions and avoiding duplicate test coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b0295cc7-fc48-4b5a-aa1d-ec0ffb6f012f

📥 Commits

Reviewing files that changed from the base of the PR and between 4498917 and 3ac2728.

📒 Files selected for processing (11)
  • operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller.go
  • operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller_integration_test.go
  • operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller_test.go
  • operators/multiclusterobservability/controllers/multiclusterobservability/predicate_func.go
  • operators/multiclusterobservability/controllers/placementrule/hub_info_secret_test.go
  • operators/multiclusterobservability/controllers/placementrule/manifestwork_test.go
  • operators/multiclusterobservability/controllers/placementrule/mco_predicate_test.go
  • operators/multiclusterobservability/controllers/placementrule/placementrule_controller.go
  • operators/multiclusterobservability/controllers/placementrule/placementrule_controller_test.go
  • operators/multiclusterobservability/pkg/config/config.go
  • operators/multiclusterobservability/pkg/config/config_test.go
💤 Files with no reviewable changes (6)
  • operators/multiclusterobservability/controllers/multiclusterobservability/predicate_func.go
  • operators/multiclusterobservability/controllers/placementrule/manifestwork_test.go
  • operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller.go
  • operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller_integration_test.go
  • operators/multiclusterobservability/controllers/placementrule/placementrule_controller.go
  • operators/multiclusterobservability/pkg/config/config_test.go

Signed-off-by: Daniel Buchanan <dbuchana@redhat.com>

@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.

🧹 Nitpick comments (1)
operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller.go (1)

798-859: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

context.TODO() is a placeholder that outlived its welcome.

GenerateAlertmanagerRoute doesn't accept a context.Context and instead calls runclient.Get(context.TODO(), ...), unlike its siblings GenerateAPIGatewayRoute/GenerateGrafanaRoute which thread the Reconcile ctx through. Since this function is being reintroduced in this PR, it's a good spot to wire up proper cancellation instead of importing another TODO. As per path instructions, "Check for proper context propagation and cancellation."

Note: dropping the BYO CA/cert/key population for the route's TLS is fine — OpenShift falls back to the service-serving CA bundle when destinationCACertificate is unset on a reencrypt route, so no TLS verification regression here.

♻️ Proposed fix to thread context through
 func GenerateAlertmanagerRoute(
-	runclient client.Client, scheme *runtime.Scheme,
+	ctx context.Context, runclient client.Client, scheme *runtime.Scheme,
 	mco *mcov1beta2.MultiClusterObservability,
 ) (*ctrl.Result, error) {
@@
 	found := &routev1.Route{}
 	err := runclient.Get(
-		context.TODO(),
+		ctx,
 		types.NamespacedName{Name: amGateway.Name, Namespace: amGateway.Namespace},
 		found,
 	)

And update the call site:

-		result, err = GenerateAlertmanagerRoute(r.Client, r.Scheme, instance)
+		result, err = GenerateAlertmanagerRoute(ctx, r.Client, r.Scheme, instance)
🤖 Prompt for 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.

In
`@operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller.go`
around lines 798 - 859, Update GenerateAlertmanagerRoute to accept a
context.Context parameter and replace both context.TODO() usages in the client
Get and Create calls with that context. Update its caller to pass the Reconcile
ctx, matching the context propagation used by GenerateAPIGatewayRoute and
GenerateGrafanaRoute.

Source: Path instructions

🤖 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.

Nitpick comments:
In
`@operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller.go`:
- Around line 798-859: Update GenerateAlertmanagerRoute to accept a
context.Context parameter and replace both context.TODO() usages in the client
Get and Create calls with that context. Update its caller to pass the Reconcile
ctx, matching the context propagation used by GenerateAPIGatewayRoute and
GenerateGrafanaRoute.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 35c4a8bd-56b4-4bad-8540-35cf36be0e94

📥 Commits

Reviewing files that changed from the base of the PR and between 3ac2728 and 5b86f0d.

📒 Files selected for processing (2)
  • operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller.go
  • operators/multiclusterobservability/pkg/config/config.go

Signed-off-by: Daniel Buchanan <dbuchana@redhat.com>
@coleenquadros

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Jul 15, 2026
@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: coleenquadros, dbuchanaRH

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [coleenquadros,dbuchanaRH]

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

@coleenquadros

Copy link
Copy Markdown
Contributor

/test e2e-kind

@openshift-merge-bot
openshift-merge-bot Bot merged commit ca3d216 into stolostron:main Jul 15, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants