Skip to content

OU-1389: swap monitoring-plugin to be feature driven#1034

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
PeterYurkovich:swap-monitoring-to-features
Jul 9, 2026
Merged

OU-1389: swap monitoring-plugin to be feature driven#1034
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
PeterYurkovich:swap-monitoring-to-features

Conversation

@PeterYurkovich

@PeterYurkovich PeterYurkovich commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a set that looks to update the monitoring-plugin to be feature driven, allowing for each feature to be toggled on or off individually. This conversion will happen over the course of the following PRs:

  1. Fix CMO to pass the correct config directory to the monitoring-plugin so that the *.patch.json feature files are able to be loaded correctly (OU-1389: config path to point to correct directory cluster-monitoring-operator#2981)
  2. This PR which changes the monitoring-plugin backend to be feature driven and handle no feature flags so that the current monitoring-plugin features are enabled for backwards compatability
  3. Change CMO to directly pass in the alerting, targets, metrics and legacy-dashboards feature flags to the monitoring-plugin. Ensure the TestClusterMonitorConsolePlugin test still passes
  4. Adjust the monitoring-plugin to serve no features is no feature flags are passed in

Summary by CodeRabbit

  • New Features

    • Added console navigation, pages, and dev tabs for Alerting, Legacy Dashboards, Metrics, and Targets across standard and virtualization perspectives.
    • Enabled these observability features by default in local startup flows.
  • Bug Fixes

    • Updated backend/console startup to use port 9443 and adjusted container startup config path.
    • Improved extension startup behavior by suppressing “no extensions” warnings.
  • Documentation

    • Refreshed feature-flag, local development, and troubleshooting guidance, including updated startup commands and port instructions.

@openshift-ci-robot

openshift-ci-robot commented Jul 6, 2026

Copy link
Copy Markdown

@PeterYurkovich: This pull request references OU-1137 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 task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This PR looks to update the monitoring-plugin to be feature driven, allowing for each feature to be toggled on or off individually. This conversion will happen over the course of the following PRs:

  1. Fix CMO to point to the correct config directory
  2. This PR, which change the backend to handle such that if no feature flags are passed then the current monitoring-plugin features are enabled
  3. Change CMO to directly pass in the alerting, targets, metrics and legacy-dashboards feature flags to the monitoring-plugin. Ensure the TestClusterMonitorConsolePlugin test still passes
  4. Adjust the monitoring-plugin to serve no features is no feature flags are passed in

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 6, 2026
@openshift-ci openshift-ci Bot requested review from etmurasaki and zhuje July 6, 2026 11:37
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 7e651a69-370f-47c8-98e2-4bf70ebb730b

📥 Commits

Reviewing files that changed from the base of the PR and between 663830b and 2b069ee.

📒 Files selected for processing (2)
  • Makefile
  • pkg/plugin_handler.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/plugin_handler.go
  • Makefile

Walkthrough

The PR splits console extensions into patch files, adds new monitoring feature flags and default feature enabling, and updates startup, Docker, webpack, and documentation to match the new patch-based console configuration.

Changes

Monitoring console patch rollout

Layer / File(s) Summary
Feature flags and manifest patching
pkg/server.go, pkg/plugin_handler.go, cmd/plugin-backend.go
Adds Alerting, LegacyDashboards, Metrics, and Targets feature constants, defaults them when features are unset, and applies console patches through an ordered feature-gated patch list. The backend -features help text is updated to match the new feature names.
Console extension patch files
config/alerting.patch.json, config/legacy-dashboards.patch.json, config/metrics.patch.json, config/targets.patch.json
Adds navigation links, page routes, and dev-console tabs for alerting, legacy dashboards, metrics, and targets across admin, virtualization, and dev contexts.
Monitoring plugin and dashboard patch ordering
config/monitoring-plugin.patch.json, config/acm-alerting.patch.json, config/cluster-health-analyzer.patch.json, config/perses-dashboards.patch.json
Adds the virtualization observe section and reducer wiring, retargets patch insertion indexes, and expands Perses dashboard routes and navigation entries.
Runtime and developer workflow updates
Dockerfile.mcp, web/webpack.config.ts, Makefile, scripts/start-console.sh, .claude/commands/run-perses-dev.md, README.md, AGENTS.md, CONTRIBUTING.md, web/console-extensions.json
Updates the container entrypoint, webpack config, Makefile targets, console port defaults, dev commands, and documentation to use the new patch-based setup and ports. It also removes the monolithic console extensions file.

Estimated code review effort: 4 (Complex) | ~60 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making the monitoring-plugin feature driven.
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.
Stable And Deterministic Test Names ✅ Passed The PR only changes Makefile and pkg/plugin_handler.go; no *_test.go files or Ginkgo titles were added or modified.
Test Structure And Quality ✅ Passed The commit only changes Makefile and pkg/plugin_handler.go; no Ginkgo test code was added or modified, so the test-quality checks are not applicable.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added in the diff; only Makefile and backend manifest logic changed.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Go/Ginkgo e2e tests were added; the diff is docs/config/JS specs, so there are no SNO assumptions to review.
Topology-Aware Scheduling Compatibility ✅ Passed Touched files only adjust feature flags, console extension patches, and startup args; no pod specs, replicas, affinity, nodeSelectors, or PDBs were added.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes were added: main only uses logrus, and searches found no fmt.Print*, klog stdout, or TestMain/BeforeSuite/RunSpecs emitters.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo/e2e test files were added; the PR only changes docs, config patches, and backend wiring.
No-Weak-Crypto ✅ Passed PR only changes feature flags/routes and TLS flag help text; no added MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons in changed files.
Container-Privileges ✅ Passed HEAD only changes Makefile and pkg/plugin_handler.go; no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings appear.
No-Sensitive-Data-In-Logs ✅ Passed No new sensitive-data logs were added in the touched files; Makefile has none, and pkg/plugin_handler.go only keeps existing error logs.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@PeterYurkovich

Copy link
Copy Markdown
Contributor Author

/hold for CMO PR

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 6, 2026
@PeterYurkovich PeterYurkovich changed the title OU-1137: swap monitoring-plugin to be feature driven OU-1389: swap monitoring-plugin to be feature driven Jul 8, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 8, 2026

Copy link
Copy Markdown

@PeterYurkovich: This pull request references OU-1389 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 task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This PR looks to update the monitoring-plugin to be feature driven, allowing for each feature to be toggled on or off individually. This conversion will happen over the course of the following PRs:

  1. Fix CMO to point to the correct config directory (OU-1389: config path to point to correct directory cluster-monitoring-operator#2981)
  2. This PR, which change the backend to handle such that if no feature flags are passed then the current monitoring-plugin features are enabled
  3. Change CMO to directly pass in the alerting, targets, metrics and legacy-dashboards feature flags to the monitoring-plugin. Ensure the TestClusterMonitorConsolePlugin test still passes
  4. Adjust the monitoring-plugin to serve no features is no feature flags are passed in

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.

@PeterYurkovich

Copy link
Copy Markdown
Contributor Author

/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 8, 2026
@etmurasaki

Copy link
Copy Markdown
Contributor

/test e2e-monitoring

@etmurasaki

Copy link
Copy Markdown
Contributor

e2e-perses was run locally against a running cluster with COO already installed and it passed except scenarios involving bug https://redhat.atlassian.net/browse/OU-1466. Other than that, it was working fine.

@etmurasaki

Copy link
Copy Markdown
Contributor

/label qe-approved

@openshift-ci openshift-ci Bot added the qe-approved Signifies that QE has signed off on this PR label Jul 8, 2026
Comment thread pkg/plugin_handler.go Outdated
Comment thread pkg/plugin_handler.go Outdated
Comment thread config/alerting.patch.json Outdated
@jgbernalp

Copy link
Copy Markdown
Contributor

I got an error while trying to start the backend locally:

ERRO[0000] cannot patch base manifest file               error="error in add for path: '/extensions/1': Unable to access invalid index: 1: invalid index referenced" module=manifest

this might be caused by trying to add an element to an empty array in the json.

@PeterYurkovich PeterYurkovich force-pushed the swap-monitoring-to-features branch from 53d0f9f to 663830b Compare July 9, 2026 12:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
pkg/plugin_handler.go (1)

35-58: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make feature patching deterministic
pkg/plugin_handler.go:50-55 iterates over cfg.Features, so the per-feature patch order is arbitrary. Because every patch inserts at /extensions/0, the final manifest order can change between process restarts/replicas and affect overlapping console.page/route entries. Sort the enabled feature keys before applying these patches.

🤖 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 `@pkg/plugin_handler.go` around lines 35 - 58, Make the per-feature patch
application in patchManifest deterministic by avoiding direct iteration over
cfg.Features; collect the enabled feature keys, sort them first, and then apply
each feature patch in that stable order. Keep the existing special-case handling
for ClusterHealthAnalyzer and Incidents unchanged, but ensure the loop that
calls performPatch with fmt.Sprintf("%s.patch.json", feature) uses the sorted
list so overlapping /extensions/0 inserts produce consistent manifest output.
🧹 Nitpick comments (3)
config/acm-alerting.patch.json (1)

4-95: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Prefer the RFC 6902 append token over a hardcoded index.

Switching from /extensions/1 to /extensions/0 fixes the reported out-of-bounds crash on a short/empty extensions array, but since all six add ops in this file target the same fixed index, each subsequent op inserts before the previous one — reversing this file's own declaration order in the final manifest. Using the RFC 6902 "-" token (/extensions/-) appends after the last element regardless of current array length, which sidesteps both the out-of-bounds risk and the ordering inversion, and is supported by evanphx/json-patch (the library used via jsonpatch.DecodePatch in pkg/plugin_handler.go).

🔧 Suggested fix
-    "path": "/extensions/0",
+    "path": "/extensions/-",

(apply to each add op in this file)

🤖 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 `@config/acm-alerting.patch.json` around lines 4 - 95, The patch ops in the
alerting manifest currently use a fixed "/extensions/0" target for every add,
which reverses the intended order and still depends on array state. Update each
console.navigation/section and console.page/route add operation in this patch
file to use the RFC 6902 append token "/extensions/-" so the entries are
appended in declaration order regardless of existing length.
config/perses-dashboards.patch.json (1)

4-134: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Same fixed-index-append pattern as acm-alerting.patch.json, with added route-overlap risk.

This file has 10 sequential add ops all targeting /extensions/0, so within this document, insertion order is reversed. This file also declares multiple exact: false list routes (/monitoring/v2/dashboards, /multicloud/monitoring/v2/dashboards, /virt-monitoring/v2/dashboards) alongside more specific /view routes under the same prefixes. If console's route matching for overlapping exact: false paths is order-sensitive, the relative position of these entries in the final extensions array matters. Combined with the non-deterministic per-feature loop ordering noted in pkg/plugin_handler.go, using /extensions/- (RFC 6902 append token) here would remove this ordering dependency entirely rather than relying on the current reversal happening to work out.

🤖 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 `@config/perses-dashboards.patch.json` around lines 4 - 134, The patch uses
repeated inserts at /extensions/0, which reverses the intended order and creates
a fragile dependency for overlapping exact: false routes in DashboardListPage
and DashboardPage. Update this patch to append each new extension with
/extensions/- so the final array order matches the declaration order without
relying on reversal or loop behavior, especially for the
/monitoring/v2/dashboards, /multicloud/monitoring/v2/dashboards, and
/virt-monitoring/v2/dashboards entries.
AGENTS.md (1)

8-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Include the backend feature registry in the onboarding checklist.

The new-feature guidance now points at patch files/components, but feature work still needs pkg/server.go and web/src/components/hooks/useFeatures.ts to wire new flags through the backend and UI. Without those files in the guide, contributors can update a patch without making it load.

Suggested fix
- **Key Files**: `config/*.patch.json`, `web/src/components/`
+ **Key Files**: `pkg/server.go`, `web/src/components/hooks/useFeatures.ts`, `config/*.patch.json`, `web/src/components/`
🤖 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 `@AGENTS.md` around lines 8 - 18, The new-feature checklist is missing the
backend feature wiring steps, so update the onboarding guidance to explicitly
include `pkg/server.go` and `web/src/components/hooks/useFeatures.ts` alongside
the existing patch/component steps. Make sure the “Adding a New Feature” section
tells contributors to register new flags in `pkg/server.go` and expose them
through `useFeatures.ts` so feature work is actually loaded end-to-end.
🤖 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 `@pkg/plugin_handler.go`:
- Around line 35-58: Make the per-feature patch application in patchManifest
deterministic by avoiding direct iteration over cfg.Features; collect the
enabled feature keys, sort them first, and then apply each feature patch in that
stable order. Keep the existing special-case handling for ClusterHealthAnalyzer
and Incidents unchanged, but ensure the loop that calls performPatch with
fmt.Sprintf("%s.patch.json", feature) uses the sorted list so overlapping
/extensions/0 inserts produce consistent manifest output.

---

Nitpick comments:
In `@AGENTS.md`:
- Around line 8-18: The new-feature checklist is missing the backend feature
wiring steps, so update the onboarding guidance to explicitly include
`pkg/server.go` and `web/src/components/hooks/useFeatures.ts` alongside the
existing patch/component steps. Make sure the “Adding a New Feature” section
tells contributors to register new flags in `pkg/server.go` and expose them
through `useFeatures.ts` so feature work is actually loaded end-to-end.

In `@config/acm-alerting.patch.json`:
- Around line 4-95: The patch ops in the alerting manifest currently use a fixed
"/extensions/0" target for every add, which reverses the intended order and
still depends on array state. Update each console.navigation/section and
console.page/route add operation in this patch file to use the RFC 6902 append
token "/extensions/-" so the entries are appended in declaration order
regardless of existing length.

In `@config/perses-dashboards.patch.json`:
- Around line 4-134: The patch uses repeated inserts at /extensions/0, which
reverses the intended order and creates a fragile dependency for overlapping
exact: false routes in DashboardListPage and DashboardPage. Update this patch to
append each new extension with /extensions/- so the final array order matches
the declaration order without relying on reversal or loop behavior, especially
for the /monitoring/v2/dashboards, /multicloud/monitoring/v2/dashboards, and
/virt-monitoring/v2/dashboards entries.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 1277e1fd-d3d2-4948-bc69-8c831476c024

📥 Commits

Reviewing files that changed from the base of the PR and between 097f674 and 663830b.

📒 Files selected for processing (22)
  • .claude/commands/run-perses-dev.md
  • AGENTS.md
  • CONTRIBUTING.md
  • Dockerfile.mcp
  • Makefile
  • README.md
  • cmd/plugin-backend.go
  • config/acm-alerting.patch.json
  • config/alerting.patch.json
  • config/clear-extensions.patch.json
  • config/cluster-health-analyzer.patch.json
  • config/legacy-dashboards.patch.json
  • config/metrics.patch.json
  • config/monitoring-console-plugin.patch.json
  • config/monitoring-plugin.patch.json
  • config/perses-dashboards.patch.json
  • config/targets.patch.json
  • pkg/plugin_handler.go
  • pkg/server.go
  • scripts/start-console.sh
  • web/console-extensions.json
  • web/webpack.config.ts
💤 Files with no reviewable changes (2)
  • config/clear-extensions.patch.json
  • web/console-extensions.json

Comment thread pkg/plugin_handler.go Outdated
patchedManifest = performPatch(patchedManifest, filepath.Join(cfg.ConfigPath, "monitoring-console-plugin.patch.json"))
}

for feature := range cfg.Features {

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.

maybe this is a pre existing issue, but it seems the feature iteration to perform the patches is not deterministic. Should we assign some order to the features and sort before iterating?. Or is fine and we trust the console to resolve the extensions even if they are not in order. Not sure if there will be issues with some routes that might match before others.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Routes are handled via react router, so determinism is influenced by that not the extension load order. It's not really an issue to add determinism though, is there a specific order we should do? Maybe:

  • monitoring-plugin
  • alerting
  • metrics
  • dashboards-legacy
  • targets
  • monitoring-console-plugin
  • acm-alerting
  • incidents
  • dashboards-perses

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in latest commit

Comment thread Makefile Outdated
IMAGE ?= quay.io/${ORG}/${PLUGIN_NAME}:${VERSION}
FEATURES ?=incidents,perses-dashboards,dev-config
MONITORING_FEATURES ?=alerting,targets,legacy-dashboards,metrics
ALL_FEATURES ?=alerting,targets,legacy-dashboards,metrics,incidents,perses-dashboards

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.

Suggested change
ALL_FEATURES ?=alerting,targets,legacy-dashboards,metrics,incidents,perses-dashboards
ALL_FEATURES ?=$(MONITORING_FEATURES),incidents,perses-dashboards

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in latest commit

@PeterYurkovich

Copy link
Copy Markdown
Contributor Author

/retest

@PeterYurkovich

Copy link
Copy Markdown
Contributor Author

/override ci/prow/okd-scos-images

Image pull is failing in CI, other image job is succeeding, so going to override this one

@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@PeterYurkovich: Overrode contexts on behalf of PeterYurkovich: ci/prow/okd-scos-images

Details

In response to this:

/override ci/prow/okd-scos-images

Image pull is failing in CI, other image job is succeeding, so going to override this one

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.

@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@PeterYurkovich: all tests passed!

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@jgbernalp

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 9, 2026
@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgbernalp, PeterYurkovich

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 [PeterYurkovich,jgbernalp]

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

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants