mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
fix(monitoring): select the vmalert Service the operator creates
The VMServiceScrape selected app.kubernetes.io/instance=vmalert, while the
chart names the VMAlert vmalert-<first metricsStorages name> and the
operator puts that name into the instance label of its Service. The scrape
matched nothing, so the metrics of vmalert itself were never collected.
The instance stays in the selector so the scrape keeps pointing at the one
VMAlert this release renders.
Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
(cherry picked from commit 7bda2bdbc0)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
eca015f776
commit
d671ed89fe
2 files changed
+41
-1
No files matched your search
@@ -1,3 +1,4 @@
|
||||
{{- with first .Values.metricsStorages }}
|
||||
---
|
||||
apiVersion: operator.victoriametrics.com/v1beta1
|
||||
kind: VMServiceScrape
|
||||
@@ -13,5 +14,6 @@ spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: monitoring
|
||||
app.kubernetes.io/instance: vmalert
|
||||
app.kubernetes.io/instance: vmalert-{{ .name }}
|
||||
app.kubernetes.io/name: vmalert
|
||||
{{- end }}
|
||||
@@ -0,0 +1,38 @@
|
||||
suite: vmalert metrics are scraped
|
||||
templates:
|
||||
- templates/vm/vmalert-scrape.yaml
|
||||
|
||||
release:
|
||||
name: monitoring
|
||||
namespace: tenant-root
|
||||
|
||||
set:
|
||||
_cluster:
|
||||
root-host: example.org
|
||||
_namespace:
|
||||
host: tenant-root.example.org
|
||||
ingress: tenant-root
|
||||
metricsStorages:
|
||||
- name: shortterm
|
||||
retentionPeriod: "3d"
|
||||
deduplicationInterval: "15s"
|
||||
- name: longterm
|
||||
retentionPeriod: "14d"
|
||||
deduplicationInterval: "5m"
|
||||
|
||||
tests:
|
||||
- it: selects the Service of the VMAlert the chart renders
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.selector.matchLabels
|
||||
value:
|
||||
app.kubernetes.io/component: monitoring
|
||||
app.kubernetes.io/instance: vmalert-shortterm
|
||||
app.kubernetes.io/name: vmalert
|
||||
|
||||
- it: renders nothing without metrics storages, like the VMAlert itself
|
||||
set:
|
||||
metricsStorages: []
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
Reference in new issue
Block a user