Skip to content

MON-4037: Add MonitoringPluginConfig to ClusterMonitoring API#2753

Open
danielmellado wants to merge 1 commit intoopenshift:masterfrom
danielmellado:mon_4037_monitoring_plugin_config
Open

MON-4037: Add MonitoringPluginConfig to ClusterMonitoring API#2753
danielmellado wants to merge 1 commit intoopenshift:masterfrom
danielmellado:mon_4037_monitoring_plugin_config

Conversation

@danielmellado
Copy link
Contributor

Add configuration for the monitoring-plugin component that
runs as a Deployment in openshift-monitoring, providing the
monitoring UI in the OpenShift web console.

Signed-off-by: Daniel Mellado dmellado@fedoraproject.org

Add configuration for the monitoring-plugin component that
runs as a Deployment in openshift-monitoring, providing the
monitoring UI in the OpenShift web console.

Signed-off-by: Daniel Mellado <dmellado@fedoraproject.org>
@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 10, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 10, 2026

@danielmellado: This pull request references MON-4037 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Add configuration for the monitoring-plugin component that
runs as a Deployment in openshift-monitoring, providing the
monitoring UI in the OpenShift web console.

Signed-off-by: Daniel Mellado dmellado@fedoraproject.org

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
Copy link
Contributor

openshift-ci bot commented Mar 10, 2026

Hello @danielmellado! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

This pull request introduces support for configuring a monitoring-plugin Deployment in openshift-monitoring. The changes add a new MonitoringPluginConfig type to the cluster monitoring configuration API with fields for node selection, resource requests/limits, tolerations, and pod topology spread constraints. The corresponding CustomResourceDefinition schema is updated to include the monitoringPluginConfig field with detailed validation rules. Additionally, comprehensive test cases are added to validate both successful configurations and rejection scenarios for the new monitoring plugin configuration options.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding MonitoringPluginConfig to the ClusterMonitoring API, which matches the core modifications across all three changed files.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of the MonitoringPluginConfig addition (configuration for monitoring-plugin Deployment in openshift-monitoring).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed All 11 test names are static and deterministic with no dynamic information like timestamps, UUIDs, or generated suffixes.
Test Structure And Quality ✅ Passed The custom check targets Ginkgo test code quality, but this PR adds YAML test specifications processed by an automated generator that already implements all required quality standards.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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)

Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented


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

@qodo-code-review
Copy link

Review Summary by Qodo

Add MonitoringPluginConfig to ClusterMonitoring API

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add MonitoringPluginConfig to ClusterMonitoring API spec
• Support pod scheduling configuration via nodeSelector, tolerations, topologySpreadConstraints
• Enable resource management with configurable CPU, memory, HugePages constraints
• Include comprehensive validation rules and test coverage for new config
Diagram
flowchart LR
  A["ClusterMonitoringSpec"] -->|"adds field"| B["MonitoringPluginConfig"]
  B -->|"configures"| C["Pod Scheduling"]
  B -->|"configures"| D["Resource Limits"]
  C -->|"includes"| E["nodeSelector, tolerations, topologySpreadConstraints"]
  D -->|"includes"| F["CPU, memory, HugePages"]
Loading

Grey Divider

File Changes

1. config/v1alpha1/types_cluster_monitoring.go ✨ Enhancement +80/-0

Define MonitoringPluginConfig type and API structure

• Add MonitoringPluginConfig field to ClusterMonitoringSpec struct
• Define new MonitoringPluginConfig type with nodeSelector, resources, tolerations,
 topologySpreadConstraints fields
• Include comprehensive documentation and validation constraints for all fields
• Set minProperties=1 validation to require at least one field in MonitoringPluginConfig

config/v1alpha1/types_cluster_monitoring.go


2. config/v1alpha1/zz_generated.deepcopy.go Miscellaneous +45/-0

Generate deepcopy functions for MonitoringPluginConfig

• Add DeepCopyInto method for MonitoringPluginConfig struct
• Add DeepCopy method for MonitoringPluginConfig struct
• Update ClusterMonitoringSpec DeepCopyInto to handle MonitoringPluginConfig field
• Properly handle deep copying of nested maps and slices

config/v1alpha1/zz_generated.deepcopy.go


3. config/v1alpha1/zz_generated.swagger_doc_generated.go 📝 Documentation +13/-0

Generate swagger documentation for MonitoringPluginConfig

• Add swagger documentation map for MonitoringPluginConfig
• Document all fields with descriptions for API documentation
• Update ClusterMonitoringSpec swagger doc to include monitoringPluginConfig field

config/v1alpha1/zz_generated.swagger_doc_generated.go


View more (5)
4. openapi/generated_openapi/zz_generated.openapi.go Miscellaneous +104/-1

Generate OpenAPI schema for MonitoringPluginConfig

• Add OpenAPI schema definition for MonitoringPluginConfig
• Define schema properties for nodeSelector, resources, tolerations, topologySpreadConstraints
• Include validation constraints and list type metadata in OpenAPI spec
• Update ClusterMonitoringSpec schema to reference MonitoringPluginConfig

openapi/generated_openapi/zz_generated.openapi.go


5. config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml 🧪 Tests +190/-0

Add comprehensive test cases for MonitoringPluginConfig

• Add 11 new test cases for MonitoringPluginConfig validation
• Test valid configurations with resources, tolerations, topologySpreadConstraints
• Test validation errors for empty objects, duplicate entries, limit/request violations
• Test array size constraints and field uniqueness requirements

config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml


6. config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml ⚙️ Configuration changes +349/-0

Update CRD manifest with MonitoringPluginConfig schema

• Add monitoringPluginConfig field to CRD spec with minProperties=1 constraint
• Define complete schema for nodeSelector, resources, tolerations, topologySpreadConstraints
• Include validation rules for resource limits, quantity formats, and list constraints
• Add x-kubernetes validation extensions for list types and map keys

config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml


7. config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml ⚙️ Configuration changes +349/-0

Update feature-gated CRD manifest with MonitoringPluginConfig

• Add monitoringPluginConfig field to feature-gated CRD manifest
• Mirror complete schema definition from main CRD manifest
• Include all validation constraints and Kubernetes extensions

config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml


8. payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml ⚙️ Configuration changes +349/-0

Update payload CRD manifest with MonitoringPluginConfig

• Add monitoringPluginConfig field to payload CRD manifest
• Include complete schema definition matching main CRD manifest
• Provide all validation rules and Kubernetes metadata extensions

payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 10, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. MinProperties not documented 📘 Rule violation ✓ Correctness
Description
MonitoringPluginConfig is validated with +kubebuilder:validation:MinProperties=1, but the API
comments do not document that an empty monitoringPluginConfig: {} is invalid. This violates the
requirement that validation markers and optional-field omitted behavior be fully documented for API
users.
Code

config/v1alpha1/types_cluster_monitoring.go[R576-580]

+// MonitoringPluginConfig provides configuration options for the monitoring-plugin component
+// that runs as a Deployment in the `openshift-monitoring` namespace. The monitoring-plugin is the
+// OpenShift console web plugin for monitoring, providing the monitoring UI in the OpenShift web console.
+// +kubebuilder:validation:MinProperties=1
+type MonitoringPluginConfig struct {
Evidence
PR Compliance ID 7 requires every validation marker to be documented in the corresponding field/type
comments. The new MonitoringPluginConfig type adds +kubebuilder:validation:MinProperties=1, but
neither the type comment nor the ClusterMonitoringSpec.monitoringPluginConfig field comment
explains that at least one property must be set (i.e., {} is rejected).

AGENTS.md
config/v1alpha1/types_cluster_monitoring.go[576-580]
config/v1alpha1/types_cluster_monitoring.go[110-116]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`MonitoringPluginConfig` is marked with `+kubebuilder:validation:MinProperties=1`, but the comments for the type and the `monitoringPluginConfig` field do not document that an empty object is invalid and that at least one property must be set.

## Issue Context
Compliance requires that all kubebuilder validation markers (including MinProperties) and optional-field behavior are documented in comments so users understand what inputs are accepted.

## Fix Focus Areas
- config/v1alpha1/types_cluster_monitoring.go[110-116]
- config/v1alpha1/types_cluster_monitoring.go[576-580]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@openshift-ci openshift-ci bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 10, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 10, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign deads2k for approval. For more information see the Code Review Process.

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

Details Needs approval from an approver in each of these files:

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

Comment on lines +576 to +580
// MonitoringPluginConfig provides configuration options for the monitoring-plugin component
// that runs as a Deployment in the `openshift-monitoring` namespace. The monitoring-plugin is the
// OpenShift console web plugin for monitoring, providing the monitoring UI in the OpenShift web console.
// +kubebuilder:validation:MinProperties=1
type MonitoringPluginConfig struct {

Choose a reason for hiding this comment

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

Action required

1. minproperties not documented 📘 Rule violation ✓ Correctness

MonitoringPluginConfig is validated with +kubebuilder:validation:MinProperties=1, but the API
comments do not document that an empty monitoringPluginConfig: {} is invalid. This violates the
requirement that validation markers and optional-field omitted behavior be fully documented for API
users.
Agent Prompt
## Issue description
`MonitoringPluginConfig` is marked with `+kubebuilder:validation:MinProperties=1`, but the comments for the type and the `monitoringPluginConfig` field do not document that an empty object is invalid and that at least one property must be set.

## Issue Context
Compliance requires that all kubebuilder validation markers (including MinProperties) and optional-field behavior are documented in comments so users understand what inputs are accepted.

## Fix Focus Areas
- config/v1alpha1/types_cluster_monitoring.go[110-116]
- config/v1alpha1/types_cluster_monitoring.go[576-580]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml (1)

601-769: Cover the remaining MonitoringPluginConfig validators.

These cases lock down resources and topologySpreadConstraints, but the new nodeSelector MinProperties/MaxProperties and tolerations MinItems/MaxItems branches are still untested. A couple of reject cases for nodeSelector: {} and tolerations: [] / 11 items would make this new schema much harder to regress.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml`
around lines 601 - 769, Add tests for the new MonitoringPluginConfig
nodeSelector and tolerations validators: add a reject case with
monitoringPluginConfig.nodeSelector: {} expecting an error about MinProperties
(e.g., "must have at least 1 properties"), and add two tolerations reject
cases—one with tolerations: [] expecting the MinItems error and one with
tolerations containing 11 entries expecting the MaxItems/Too many items error;
locate the MonitoringPluginConfig test block and append these cases referencing
the monitoringPluginConfig.nodeSelector and monitoringPluginConfig.tolerations
fields so the MinProperties/MaxProperties and MinItems/MaxItems branches are
covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml`:
- Around line 601-769: Add tests for the new MonitoringPluginConfig nodeSelector
and tolerations validators: add a reject case with
monitoringPluginConfig.nodeSelector: {} expecting an error about MinProperties
(e.g., "must have at least 1 properties"), and add two tolerations reject
cases—one with tolerations: [] expecting the MinItems error and one with
tolerations containing 11 entries expecting the MaxItems/Too many items error;
locate the MonitoringPluginConfig test block and append these cases referencing
the monitoringPluginConfig.nodeSelector and monitoringPluginConfig.tolerations
fields so the MinProperties/MaxProperties and MinItems/MaxItems branches are
covered.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 4a26b6e2-2b21-4dad-8e58-0bc414f795ab

📥 Commits

Reviewing files that changed from the base of the PR and between 7127010 and 331c40c.

⛔ Files ignored due to path filters (5)
  • config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1alpha1/zz_generated.deepcopy.go is excluded by !**/zz_generated*
  • config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • config/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !**/zz_generated*
  • openapi/generated_openapi/zz_generated.openapi.go is excluded by !openapi/**, !**/zz_generated*
📒 Files selected for processing (3)
  • config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml
  • config/v1alpha1/types_cluster_monitoring.go
  • payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 10, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants