-
Notifications
You must be signed in to change notification settings - Fork 129
fix: move Endpoint fields to the correct level in serviceMonitor definition #734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughMove ServiceMonitor fields (interval, scrapeTimeout, relabelings, metricRelabelings) from the top-level Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Values as Values YAML
participant Helm as Helm template
participant SM as ServiceMonitor manifest
Note over Values,Helm: Helm rendering
Values->>Helm: provide .Values.clickhouseOperator.serviceMonitor.{interval,scrapeTimeout,relabelings,metricRelabelings}
alt value present
Helm->>SM: inject field into endpoints[0] (quoted interval/scrapeTimeout, YAML relabelings/metricRelabelings)
else value absent
Helm->>SM: omit field
end
Note right of SM: Resulting ServiceMonitor has endpoint-scoped fields
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
charts/clickhouse/templates/clickhouse-operator/servicemonitor.yaml (2)
18-20: Quote the duration to enforce string typeQuoting avoids accidental numeric typing if users set an integer in values.yaml (e.g., 30) and keeps the field a string as expected by the CRD.
Apply this diff:
- interval: {{ . }} + interval: "{{ . }}"
24-26: scrapeTimeout likely belongs under endpoints; please verify against the CRDIn recent Prometheus Operator versions, scrapeTimeout is an endpoint-level field (like interval). Top-level spec.scrapeTimeout may be ignored or rejected. Consider moving it under the endpoint for consistency.
Apply this diff to remove the top-level field:
- {{- with .Values.clickhouseOperator.serviceMonitor.scrapeTimeout }} - scrapeTimeout: {{ . }} - {{- end }}Then add this block alongside the endpoint keys (right next to interval):
{{- with .Values.clickhouseOperator.serviceMonitor.scrapeTimeout }} scrapeTimeout: "{{ . }}" {{- end }}If you want, I can open a follow-up PR to make this migration consistently across charts.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
charts/clickhouse/templates/clickhouse-operator/servicemonitor.yaml(1 hunks)
🔇 Additional comments (2)
charts/clickhouse/templates/clickhouse-operator/servicemonitor.yaml (2)
18-20: Relocating interval to endpoint is correct and fixes the CRD validation errorEndpoint-level interval is the valid field in ServiceMonitor. This change aligns with the Prometheus Operator API and should resolve the apply-time error.
27-34: Confirm whether relabelings and metricRelabelings are intended at spec-levelThese are commonly endpoint-level fields in ServiceMonitor. Some charts keep them top-level for historical reasons, but CRD validation may expect them under endpoints. Please verify against your operator version.
Would you like me to prepare a patch that moves these under endpoints while preserving current values behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
charts/clickhouse/templates/clickhouse-operator/servicemonitor.yaml(1 hunks)
🔇 Additional comments (1)
charts/clickhouse/templates/clickhouse-operator/servicemonitor.yaml (1)
18-23: Correctly relocated interval and scrapeTimeout to endpoint scopeMoving these fields under the endpoint aligns with the Prometheus Operator ServiceMonitor schema. The conditional rendering with with blocks is appropriate.
There are no
interval,scrapeTimeout,relabelingsandmetricRelabelingsfields in ServiceMonitor spec so I get an error when try to apply this CRD. At least I got such error in my ArgoCD setup:To fix this just move the specified fields to Endpoint
Summary by CodeRabbit