Skip to content

Commit 23bc852

Browse files
authored
[monitoring] Add inlineScrapeConfig support to tenant vmagent (#2200)
## Summary - Adds `inlineScrapeConfig` support to the tenant `VMAgent` resource in `packages/system/monitoring/templates/vm/vmagent.yaml` - Adds commented usage example in both `packages/system/monitoring/values.yaml` and `packages/extra/monitoring/values.yaml` ## Problem The tenant VMAgent resource does not support custom scrape configurations. Using `additionalScrapeConfigs` (which references a Kubernetes Secret) is not viable because tenant users have no access to create or read Secrets — they can only manage resources under `apps.cozystack.io`. Instead, `inlineScrapeConfig` accepts inline YAML directly through Helm values, which is consistent with tenant permissions. Relates to #2194 ## Usage ```yaml vmagent: inlineScrapeConfig: | - job_name: "custom" static_configs: - targets: ["my-service:9090"] ``` ## Test plan - [ ] `helm template` monitoring with `inlineScrapeConfig` set — block rendered - [ ] `helm template` monitoring without it — no `inlineScrapeConfig` in output - [ ] Deploy and verify custom scrape targets are picked up by vmagent ```release-note Add inlineScrapeConfig support to tenant vmagent ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Support for including an inline scrape configuration into VMAgent monitoring when provided. * **Documentation** * Added a commented example showing how to supply an inline scrape job and targets. * Reordered remote-write URL entries in monitoring configuration for clearer ordering. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 3fef40e + f5d8c89 commit 23bc852

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎packages/extra/monitoring/values.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,7 @@ vmagent:
178178
urls:
179179
- http://vminsert-shortterm:8480/insert/0/prometheus
180180
- http://vminsert-longterm:8480/insert/0/prometheus
181+
## inlineScrapeConfig: |
182+
## - job_name: "custom"
183+
## static_configs:
184+
## - targets: ["my-service:9090"]

‎packages/system/monitoring/templates/vm/vmagent.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ spec:
2121

2222
scrapeInterval: 30s
2323
selectAllByDefault: false
24+
{{- with .Values.vmagent.inlineScrapeConfig }}
25+
inlineScrapeConfig: |
26+
{{- . | nindent 4 }}
27+
{{- end }}
2428
podScrapeNamespaceSelector:
2529
matchLabels:
2630
namespace.cozystack.io/monitoring: {{ .Release.Namespace }}

‎packages/system/monitoring/values.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,8 @@ vmagent:
7979
remoteWrite:
8080
urls:
8181
- http://vminsert-shortterm:8480/insert/0/prometheus
82-
- http://vminsert-longterm:8480/insert/0/prometheus
82+
- http://vminsert-longterm:8480/insert/0/prometheus
83+
## inlineScrapeConfig: |
84+
## - job_name: "custom"
85+
## static_configs:
86+
## - targets: ["my-service:9090"]

0 commit comments

Comments
 (0)