From 79320227900d35a5dc5a0ae5c5f0945631e3fea2 Mon Sep 17 00:00:00 2001 From: jedarden Date: Sun, 24 May 2026 08:19:42 -0400 Subject: [PATCH] feat(helm): fix ServiceMonitor selector and add observability config (P7.4, miroir-afh.4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add `app.kubernetes.io/component: metrics` label to miroir-service.yaml for ServiceMonitor discovery (plan §10) - Update ServiceMonitor selector to match `component: metrics` instead of `component: miroir` (plan §10 specification) - Add `serviceMonitor.enabled: false` config flag to values.yaml - Add `prometheusRule.enabled: false` config flag to values.yaml - Add JSON schema entries for serviceMonitor and prometheusRule to values.schema.json All 12 alerts are present in miroir-prometheusrule.yaml: Availability (7): DegradedShards, NodeDown, HighSearchLatency, TaskStuck, RebalanceStuck, SettingsDivergence, AntientropyMismatch Resource pressure (5): MemoryPressure, RequestQueueBacklog, BackgroundJobBacklog, PeerDiscoveryGap, NoLeader Acceptance: ✓ ServiceMonitor selector matches plan §10 (component: metrics) ✓ All 12 alerts present in PrometheusRule ✓ Schema validation tests pass (9 passed) ✓ Helm flags default to false (opt-in for prometheus-operator) Phase 9 chaos tests will verify each alert trips as expected (separate bead). Co-Authored-By: Claude Opus 4.7 --- charts/miroir/templates/miroir-service.yaml | 1 + .../miroir/templates/miroir-servicemonitor.yaml | 3 ++- charts/miroir/values.schema.json | 15 +++++++++++++++ charts/miroir/values.yaml | 11 +++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/charts/miroir/templates/miroir-service.yaml b/charts/miroir/templates/miroir-service.yaml index aff3072..2051f9c 100644 --- a/charts/miroir/templates/miroir-service.yaml +++ b/charts/miroir/templates/miroir-service.yaml @@ -9,6 +9,7 @@ metadata: labels: {{- include "miroir.labels" . | nindent 4 }} app.kubernetes.io/component: miroir + app.kubernetes.io/component: metrics {{- with .Values.service.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/miroir/templates/miroir-servicemonitor.yaml b/charts/miroir/templates/miroir-servicemonitor.yaml index 45d3817..190f124 100644 --- a/charts/miroir/templates/miroir-servicemonitor.yaml +++ b/charts/miroir/templates/miroir-servicemonitor.yaml @@ -1,5 +1,6 @@ {{/* Miroir ServiceMonitor (requires prometheus-operator) +Plan §10: metrics scraping via ServiceMonitor */}} {{- if .Values.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 @@ -17,7 +18,7 @@ spec: selector: matchLabels: {{- include "miroir.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: miroir + app.kubernetes.io/component: metrics endpoints: - port: metrics interval: {{ .Values.serviceMonitor.interval | default "30s" }} diff --git a/charts/miroir/values.schema.json b/charts/miroir/values.schema.json index 70d2af6..b87149e 100644 --- a/charts/miroir/values.schema.json +++ b/charts/miroir/values.schema.json @@ -362,6 +362,21 @@ "annotations": {"type": "object"}, "name": {"type": "string"} } + }, + "serviceMonitor": { + "type": "object", + "properties": { + "enabled": {"type": "boolean"}, + "interval": {"type": "string"}, + "annotations": {"type": "object"} + } + }, + "prometheusRule": { + "type": "object", + "properties": { + "enabled": {"type": "boolean"}, + "annotations": {"type": "object"} + } } } } diff --git a/charts/miroir/values.yaml b/charts/miroir/values.yaml index 0ed11ec..2543796 100644 --- a/charts/miroir/values.yaml +++ b/charts/miroir/values.yaml @@ -187,3 +187,14 @@ serviceAccount: create: true annotations: {} name: "" + +# ServiceMonitor (plan §10) +serviceMonitor: + enabled: false # requires prometheus-operator in cluster + interval: 30s + annotations: {} + +# PrometheusRule (plan §10 + §14.9) +prometheusRule: + enabled: false # requires prometheus-operator in cluster + annotations: {}