MON-4037: Add MonitoringPluginConfig to ClusterMonitoring API#2753
MON-4037: Add MonitoringPluginConfig to ClusterMonitoring API#2753danielmellado wants to merge 1 commit intoopenshift:masterfrom
Conversation
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>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@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. 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. |
|
Hello @danielmellado! Some important instructions when contributing to openshift/api: |
📝 WalkthroughWalkthroughThis pull request introduces support for configuring a monitoring-plugin Deployment in openshift-monitoring. The changes add a new 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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)Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented Comment |
Review Summary by QodoAdd MonitoringPluginConfig to ClusterMonitoring API
WalkthroughsDescription• 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 Diagramflowchart 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"]
File Changes1. config/v1alpha1/types_cluster_monitoring.go
|
Code Review by Qodo
1. MinProperties not documented
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
| // 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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml (1)
601-769: Cover the remainingMonitoringPluginConfigvalidators.These cases lock down
resourcesandtopologySpreadConstraints, but the newnodeSelectorMinProperties/MaxPropertiesandtolerationsMinItems/MaxItemsbranches are still untested. A couple of reject cases fornodeSelector: {}andtolerations: []/ 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
⛔ Files ignored due to path filters (5)
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yamlis excluded by!**/zz_generated.crd-manifests/*config/v1alpha1/zz_generated.deepcopy.gois excluded by!**/zz_generated*config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**config/v1alpha1/zz_generated.swagger_doc_generated.gois excluded by!**/zz_generated*openapi/generated_openapi/zz_generated.openapi.gois excluded by!openapi/**,!**/zz_generated*
📒 Files selected for processing (3)
config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yamlconfig/v1alpha1/types_cluster_monitoring.gopayload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml
|
@danielmellado: 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. |
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